Multiplot fails if it is the first plot in the script
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 274
- Fork
- 17
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
When a script has a multiplotas it's very first plot, the plot produced it's a regular plot, the second plot overwrites the first one withouth any error indication:
Let's use this small example:
import numpy as np
import gnuplotlib as gp
th = np.linspace(0, 2*np.pi, 100)
x1 = np.cos(th)
y1 = np.sin(th)
x2 = 2*np.cos(th)
y2 = 3*np.sin(th)
gp.plot(
((
x1,
y1,
dict(
legend = "Circle",
_with = "linespoints dt 4 pt 4",
)),
dict(
title="Circle",
xlabel="X",
ylabel="Y",
)),
((
x2,
y2,
dict(
legend = "Ellipse",
_with = "linespoints dt 4 pt 4",
)),
dict(title="Ellipse",
xlabel="X",
ylabel="Y",
)),
_wait=True,
square=True,
multiplot="layout 2,1"
)
This produces the following output:
As we see, the Ellipse plot has overwritten the Circle plot, totally ignoring the multiplot argument. No warnings, no errors. Just silently ignores the option.
However, if we add a regular plot before the multiplot:
import numpy as np
import gnuplotlib as gp
th = np.linspace(0, 2*np.pi, 100)
x1 = np.cos(th)
y1 = np.sin(th)
x2 = 2*np.cos(th)
y2 = 3*np.sin(th)
# Dummy plot so multiplot doesn't fail
gp.plot(
np.sin(th),
np.cos(th),
_wait=True,
)
gp.plot(
((
x1,
y1,
dict(
legend = "Circle",
_with = "linespoints dt 4 pt 4",
)),
dict(
title="Circle",
xlabel="X",
ylabel="Y",
)),
((
x2,
y2,
dict(
legend = "Ellipse",
_with = "linespoints dt 4 pt 4",
)),
dict(title="Ellipse",
xlabel="X",
ylabel="Y",
)),
_wait=True,
square=True,
multiplot="layout 2,1"
)
We get the desired output
One curious effect is that this only works if _wait=True is provided in the Dummy Plot
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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
Inizia eseguendo le due riproduzioni Python dell’issue e traccia la gestione dei plot e del multiplot nel progetto. Confronta il caso del primo plot con il caso preceduto da un plot fittizio e _wait=True. Il lavoro è completato quando uno script il cui primo plot usa multiplot="layout 2,1" esegue il rendering di entrambi i plot senza richiedere un plot fittizio né sovrascrivere silenziosamente il primo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- numpy, python
- 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
- 42/100