Multiplot fails if it is the first plot in the script
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 274
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the two Python reproductions from the issue and trace the plot and multiplot handling in the project. Compare the first-plot case with the case preceded by a dummy plot and _wait=True. Done means a script whose first plot uses multiplot="layout 2,1" renders both plots without requiring a dummy plot or silently overwriting the first one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100