full_figure_for_development giving different margins in 6.3 than in 6.2
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 18.3k
- Fork
- 2k
- Merge trung bình
- 2 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 28
Mô tả
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}
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện cả hai ví dụ với plotly.js 3.0.1 và 3.1.0 thông qua full_figure_for_development() của plotly.py, sau đó điều tra cách các giá trị lề được tính toán được tạo ra. Được xem là hoàn thành khi các khác biệt về lề liên quan đến phiên bản đã được giải thích và hành vi mong đợi được bao phủ bằng một kiểm tra hồi quy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- data-visualization
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100