full_figure_for_development giving different margins in 6.3 than in 6.2
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
I noticed that full_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 update figure.layout.height, because we want to ensure a fixed height of the plot area.
Consider this plotly.py code:
import plotly.graph_objects as go
figure_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, also margin.b differs:
import plotly.graph_objects as go
figure_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}
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
通过 plotly.py 的 full_figure_for_development(),分别使用 plotly.js 3.0.1 和 3.1.0 重现两个示例,然后调查计算出的边距值是如何生成的。版本相关的边距差异得到解释,并且预期行为由回归检查覆盖,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100