我试图在x_轴下方绘制一个箭头,代码如下:
myplot = go.Figure(data=go.Scatter(x=df['time'], y=df['count'], mode='markers'))
xstart = -2
xmax = 3.5
xmin = -3.5
padding = 0.05
ypos = -0.1
mylplot.update_layout(
plot_bgcolor=colors['backgraph'],
paper_bgcolor=colors['backpaper'],
font_color=colors['text'],
showlegend=False,
width=550,
height=550,
xaxis=dict(title_text="Time", showgrid=False, showticklabels=False),
yaxis=dict(title_text="Counts", showgrid=False, showticklabels=False),
annotations=[dict(
x=xmin,
y=ypos,
ax=xstart + padding,
ay=ypos,
xref='x',
axref='x',
yref='paper',
ayref='paper',
showarrow=True,
arrowhead=2,
arrowsize=1,
arrowwidth=3,
arrowcolor='#0000ff',
)],
但我收到以下错误:
ValueError:
Invalid value of type 'builtins.str' received for the 'ayref' property of layout.annotation
Received value: 'paper'
The 'ayref' property is an enumeration that may be specified as:
- One of the following enumeration values:
['pixel']
- A string that matches one of the following regular expressions:
['^y([2-9]|[1-9][0-9]+)?$']```
如果将ayref设置为y,则不显示箭头
我试图运行this example,但出现了相同的错误
我能够实现使用标题文本。对于希望在plotly中构建象限的用户来说,这也是一个很好的示例:
相关问题 更多 >
编程相关推荐