Im using a Python module, streamlit_plotly_events
. It is a Javascript wrapper which accepts the Figure
object as a parameter. I.e.
from streamlit_plotly_events import plotly_events
chart_selected = plotly_events(fig, click_event=False, hover_event=True)
The above command both displays the chart and passes any chart-selected data back to chart_selected.
I’m setting the modebar parameters using config. I.e.
config = {
# This adds the "save as svg" button
'toImageButtonOptions': {
'format': 'svg', # one of png, svg, jpeg, webp
'filename': svgfilename,
'height': 640,
'width': 1024,
'scale': 1 # Multiply title/legend/axis/canvas sizes by this factor
},
# This adds the plotly feature to draw markers on chart
'modeBarButtonsToAdd':['drawline',
'drawopenpath',
'drawclosedpath',
'drawcircle',
'drawrect',
'eraseshape'
]
}
fig.show(config = config)
However, I have not found a way to accomplish this using the plotly_events()
method.
Can the configuration of fig
be updated separately - before passing it to plotly_events()
. I.e. fig.display_update(config)
or something?
I’ve looked at the docs but I’m not divining if one of these does what I need (based on the config dict.)