full_figure_for_development giving different margins in 6.3 than in 6.2
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 18.3k
- Fork
- 2k
- Merge medio
- 2g 12h
- PR unite (30g)
- 28
Descrizione
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}
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riprodurre entrambi gli esempi con plotly.js 3.0.1 e 3.1.0 tramite full_figure_for_development() di plotly.py, quindi analizzare come vengono prodotti i valori dei margini calcolati. Il lavoro è completato quando le differenze dei margini relative alla versione sono spiegate e il comportamento previsto è coperto da un controllo di regressione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- data-visualization
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100