In Plotly 4 they moved over to plotly.graph_objects. Prior to 4 plotly.graph_objs was used. In Anvil plotly.graph_objs is what is imported. Sorry for the confusion.
In 4 both are accessible but there was a syntax change to make it more pronounceable. So this makes it appear that Plotly 4 hasn’t been implemented by Anvil yet.
My original post was returning an entire figure (data + layout). In the Anvil documentation, it implies you should assign data to self.plot_name.data. Would it be possible to assign the entire figure to self.plot_name?
If this was possible it would be more in line with the Plotly style of figure creation and, in my opinion, make it easier to prototype and iterate plots.