Multiplot fails if it is the first plot in the script
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 274
- 派生
- 17
- PR 合并指标
- 30 天内没有已合并 PR
描述
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
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行 issue 中的两个 Python 复现,并跟踪项目对 plot 和 multiplot 的处理。比较第一个 plot 的情况与在其之前有一个 dummy plot 和 _wait=True 的情况。完成标准是:一个第一个 plot 使用 multiplot="layout 2,1" 的脚本能够渲染两个 plot,而不需要 dummy plot,也不会静默覆盖第一个 plot。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- numpy, python
- 领域
- data-visualization
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100