0
通过plotly创建2D散点图可以按照从例子来完成:如何添加箭头原轴下方plotly 2D散点图
https://plot.ly/python/line-and-scatter/
然而,有没有简单的方法,下面添加箭头x轴?
通过plotly创建2D散点图可以按照从例子来完成:如何添加箭头原轴下方plotly 2D散点图
https://plot.ly/python/line-and-scatter/
然而,有没有简单的方法,下面添加箭头x轴?
你可以使用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))
你知道该怎么做注释的3D?我没有问题在2D上重现您的结果,但是当我尝试应用3D图形时,注释不会在旋转后跟随图形(或节点)。 – user2149631
@ user2149631:我认为scatter3d的行为与注释不同。请参阅:https://plot.ly/javascript/text-and-annotations/#3d-annotations –
谢谢,马克西米利安!是否可以将箭头放在绘图区域之外的3D上?我想是这样的:P =布局(P, 场景=名单( 注释=名单(名单( X = 0.3, Y = -0.1, Z = -0.1, 文本= “12345”, textangle = 0, 斧= 0,AY = -75, 外部参照= 'X', axref = 'X', YREF = '纸', ayref = '纸', ZREF = '纸', arrowcolor =“black”, arrowsize = 3, arrowwidth = 1, arrowhead = 1 )) ) )。但它不起作用。 – user2149631