hello!
I am working on a 3d bubble chart and I have updatemenus with the method ‘update’ to refresh the data and the layout of the chart. I want the name of z-axis to change for each updatemenu and a different value for ‘d-tick’ but I cannot manage it…
I tried the solution from this forum (for 2d scatter: Changing the xy-Axis Titles with Dropdown Menu)
Here is my code:
defining 3 traces, etc…
updatemenus = list([
dict(
active=2,
buttons=list([
dict(label='return_b',
method='update',
args=[{'visible': [True, False, False]},
{'title': 'return_b',
'xaxis': {'title': 'quality_x'},
'yaxis': {'title': 'quality_y'},
'zaxis': {
'title': 'return_b',
'dtick': 0.3,
'tickformat': ',.2%',
'backgroundcolor': 'rgb(220, 220, 220)',
'gridcolor': 'rgb(180, 180, 180)',
'showbackground': True,
'zerolinecolor': 'rgb(255, 255, 255)'
}}
]),
dict(label='return_net',
method='update',
args=[{'visible': [False, True, False]},
{'title': 'return_net',
'xaxis': {'title': 'quality_x'},
'yaxis': {'title': 'quality_y'},
'zaxis': {
'title': 'return_net_z',
'dtick': 0.01,
'tickformat': ',.2%',
'backgroundcolor': 'rgb(220, 220, 220)',
'gridcolor': 'rgb(180, 180, 180)',
'showbackground': True,
'zerolinecolor': 'rgb(255, 255, 255)'
}}
]),
dict(label='discount factor',
method='update',
args=[{'visible': [False, False, True]},
{'title': 'discount factor',
'xaxis': {'title': 'quality_x'},
'yaxis': {'title': 'quality_y'},
'zaxis': {
'title': 'discount factor',
'dtick': 0.005,
'tickformat': ',.2%',
'backgroundcolor': 'rgb(220, 220, 220)',
'gridcolor': 'rgb(180, 180, 180)',
'showbackground': True,
'zerolinecolor': 'rgb(255, 255, 255)'
}}
]),
]),
)
])
layout = go.Layout(updatemenus=updatemenus)
fig = go.Figure(data=data, layout=layout)
plotly.offline.plot(fig, filename='3d-bubble-return.html')
the result is strange: I have all the arguments in the updatemenu list/dictionary to update the layout but it seems to have no effect on the chart. Could anyone please give me a feedback on my problem?
Thank you very much!