答案 0 :(得分:1)
您可以在没有文字的情况下使用Plotly annotations。
import plotly
import numpy as np
plotly.offline.init_notebook_mode()
N = 1000
data = [plotly.graph_objs.Scatter(x=np.random.randn(N),
y=np.random.randn(N),
mode = 'markers'
)
]
xstart = -2
xmax = 3.5
xmin = -3.5
padding = 0.05
ypos = -0.1
layout = plotly.graph_objs.Layout(
xaxis=dict(range=[xmin, xmax]),
showlegend=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',
),
dict(
x=xmax,
y=ypos,
ax=xstart - padding,
ay=ypos,
xref='x',
axref='x',
yref='paper',
ayref='paper',
showarrow=True,
arrowhead=2,
arrowsize=1,
arrowwidth=3,
arrowcolor='#ff0000',
)
])
plotly.offline.iplot(plotly.graph_objs.Figure(data=data,
layout=layout))