有没有办法在情节情节中制作分组线?
Is there a way to make grouped lines in a plotly plot?
我是 julia 的新手,也是 Plotly 的新手,所以我正在努力获得我想要的情节。
假设我有一些我想绘制的列表,但我想以组的形式制作它,这样我就可以同时激活或停用这些图:
x1_group1 = [-2,2,3]
y1_group1 = [3,2,-2]
x2_group1 = [-1,1]
y2_group1 = [0,0]
x1_group2 = [1,2]
y1_group2 = [1,3]
p1 = scatter(x=x1_group1,y=y1_group1)
p2 = scatter(x=x2_group1,y=y2_group1)
p3 = scatter(x=x1_group2,y=y1_group2)
plot([p1,p2,p3])
这就是我目前正在做的,但我想将所有线条都放在一个图中,但按组划分,如下所示:
代码:
using PlotlyJS
x1_group1 = [-2,2,3]
y1_group1 = [3,2,-2]
x2_group1 = [-1,1]
y2_group1 = [0,0]
x1_group2 = [1,2]
y1_group2 = [1,3]
p1 = scatter(
x=x1_group1,
y=y1_group1,
legendgroup="group1",
legendgrouptitle_text="1st Group",
name="1st legend group",
mode="lines"
)
p2 = scatter(
x=x2_group1,
y=y2_group1,
legendgroup="group1",
name="1st legend group",
mode="lines"
)
p3 = scatter(
x=x1_group2,
y=y1_group2,
legendgroup="group2",
legendgrouptitle_text="1st Group",
name="2nd legend group",
mode="lines"
)
plot([p1, p2, p3])
输出:
我是 julia 的新手,也是 Plotly 的新手,所以我正在努力获得我想要的情节。
假设我有一些我想绘制的列表,但我想以组的形式制作它,这样我就可以同时激活或停用这些图:
x1_group1 = [-2,2,3]
y1_group1 = [3,2,-2]
x2_group1 = [-1,1]
y2_group1 = [0,0]
x1_group2 = [1,2]
y1_group2 = [1,3]
p1 = scatter(x=x1_group1,y=y1_group1)
p2 = scatter(x=x2_group1,y=y2_group1)
p3 = scatter(x=x1_group2,y=y1_group2)
plot([p1,p2,p3])
这就是我目前正在做的,但我想将所有线条都放在一个图中,但按组划分,如下所示:
代码:
using PlotlyJS
x1_group1 = [-2,2,3]
y1_group1 = [3,2,-2]
x2_group1 = [-1,1]
y2_group1 = [0,0]
x1_group2 = [1,2]
y1_group2 = [1,3]
p1 = scatter(
x=x1_group1,
y=y1_group1,
legendgroup="group1",
legendgrouptitle_text="1st Group",
name="1st legend group",
mode="lines"
)
p2 = scatter(
x=x2_group1,
y=y2_group1,
legendgroup="group1",
name="1st legend group",
mode="lines"
)
p3 = scatter(
x=x1_group2,
y=y1_group2,
legendgroup="group2",
legendgrouptitle_text="1st Group",
name="2nd legend group",
mode="lines"
)
plot([p1, p2, p3])
输出: