Python 图形对象更新\u xaxes未更新
我有一个简单的代码:Python 图形对象更新\u xaxes未更新,python,object,graph,plotly,subplot,Python,Object,Graph,Plotly,Subplot,我有一个简单的代码: from plotly.subplots import make_subplots import plotly.graph_objects as go surf=make_subplots( rows=1, cols=2, subplot_titles=( 'Surface growing for {} seconds'.format(stop), 'Surface growing for {} seconds'.f
from plotly.subplots import make_subplots
import plotly.graph_objects as go
surf=make_subplots(
rows=1,
cols=2,
subplot_titles=(
'Surface growing for {} seconds'.format(stop),
'Surface growing for {} seconds'.format(stop)
),
horizontal_spacing=0.1,
specs=[[{"type": "scene"},{"type": "scene"}]]
)
surf.update_layout(
template='plotly_dark',
updatemenus=[
dict(
font=dict(
family='Open Sans',
size=15,
color='black'
),
bgcolor='gray',
bordercolor='white',
borderwidth=3,
type='buttons',
buttons=[
dict(
label='Play',
method='animate',
args=[None]
)
]
)
],
width=1200,
height=900
)
surf.add_trace(
go.Scatter3d(
showlegend=False,mode='markers',x=[0],y=[0],z=[0],marker_size=9
),1,1
)
surf.add_trace(
go.Scatter3d(
showlegend=False,mode='markers',x=[0],y=[0],z=[0],marker_size=9
),1,2
)
surf.update_xaxes(title='X Real',row=1,col=1)
pio.show(surf)
但X轴的标题并未更新,如附件中所示:
我在plotly社区中看到,指令:
surf.update_xaxes(title='X Real',row=1,col=1)
是更新plotly子地块中轴属性问题的有效解决方案,但对我来说,由于某种原因,它无法工作。谁能帮我告诉我我错过了什么?谢谢。在这里,您应该使用不同的方式来更新布局。我还为第二个子地块添加了一个示例
surf.update\u布局(场景=dict(xaxis\u title='X Real'),
场景2=dict(xaxis_title='X Fake'))
其中,scene
是第一个子地块的布局,scene2
是第二个子地块的布局。
stop
未定义。非常感谢您的帮助,它解决了问题。