Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2k
Open
Description
I noticed thatfull_figure_for_development gives different margins in plotly.py 6.2 and 6.3, probably because of the plotly.js version bump from 3.0.1 to 3.1.0. Can this be considered a bug? In our use case, we read and use these values to updatefigure.layout.height, because we want to ensure a fixed height of the plot area.
Consider this plotly.py code:
import plotly.graph_objects as gofigure_dict = { "data": [ { "x": ["A", "B", "C", "D"], "y": [100, 200, 150, 300], "type": "bar" } ], "layout": { "margin": { "b": 40, "l": 0, "r": 0, "t": 0 }, "yaxis": { "tickfont": { "size": 19 }, "ticklabelposition": "inside top", "ticklen": 10 } }}figure = go.Figure(data=figure_dict["data"], layout=figure_dict["layout"])fffd = figure.full_figure_for_development()print(fffd.layout.computed["margin"])Output for 6.2.0:
{'b': 105, 'l': 0, 'r': 0, 't': 4}
Output for 6.3.0:
{'b': 105, 'l': 0, 'r': 0, 't': 0}
With this second example, alsomargin.b differs:
import plotly.graph_objects as gofigure_dict = { "data": [ { "x": [ "A", "B", "C", "D" ], "y": [ 100, 200, 150, 190 ], "type": "bar" } ], "layout": { "yaxis": { "automargin": "height", "ticklabelposition": "inside top", "insiderange": [ 0, 250 ] }, "autosize": True, "legend": { "orientation": "v", "x": 0.05, "y": -0.1, "yanchor": "top" }, "margin": { "autoexpand": True, "b": 40, "l": 0, "r": 0, "t": 0 }, "showlegend": True }}figure = go.Figure(data=figure_dict["data"], layout=figure_dict["layout"])fffd = figure.full_figure_for_development()print(fffd.layout.computed["margin"])Output for 6.2.0:
{'b': 70, 'l': 0, 'r': 0, 't': 17}
Output for 6.3.0:
{'b': 72, 'l': 0, 'r': 0, 't': 0}
Metadata
Metadata
Assignees
Labels
No labels