full_figure_for_development giving different margins in 6.3 than in 6.2
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 18.3k
- Forks
- 2k
- Merge medio
- 2 d 12 h
- PR fusionados (30 d)
- 28
Descripción
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}
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Reproduce ambos ejemplos con plotly.js 3.0.1 y 3.1.0 mediante full_figure_for_development() de plotly.py y, a continuación, investiga cómo se generan los valores de margen calculados. Se considera completado cuando se hayan explicado las diferencias de margen relacionadas con la versión y el comportamiento esperado esté cubierto por una comprobación de regresión.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100