- You can return a plotly express figure to the client and then assign this to the Plot instance’s figure attribute
# client
self.plot_1.figure = anvil.server.call("get_figure")
# server
@anvil.server.callable
def get_figure():
import plotly.express as px
df = px.data.iris()
fig = px.scatter_3d(df, x='sepal_length', y='sepal_width', z='petal_width',
color='species')
return fig
- Pretty much anything you can do in plotly express you can do with plotly graph objects, but it’s not always obvious how to do it. The plotly docs don’t alway show you how. But take a look at this related question:
- Plenty of people have used other visualization libraries. You’ll want to find a javascript library and then use the javascript ↔ python bridge to get it to work with anvil.
Here’s an example from our blog: