【发布时间】:2020-11-16 18:32:45
【问题描述】:
我正在尝试使用 Vega-Lite 绘制类似于图的绘图,其中节点通过边连接到其他节点。节点的大小根据变量而变化,而边的宽度也不同。 节点信息与边信息存储在不同的数据集中。
问题是,一旦我尝试将所有内容绘制在一起(“节点”+“边缘”),Vega-Lite 会将节点的大小标记为非常小(几乎不可见)。如果我的边缘图不使用“大小”,一切都会正常。
这是我正在做的一个例子(注意符号与原生 Vega-Lite 有点不同,因为我在 Julia 上编程):
v1 = @vlplot(
mark={:circle,opacity=1},
x={μ[:,1],type="quantitative",axis=nothing},
y={μ[:,2],type="quantitative",axis=nothing},
width=600,
height=400,
size={μ_n,legend=nothing,type="q"})
v2 = @vlplot(
mark={"type"=:circle,color="red",opacity=1},
x={ν[:,1],type="quantitative",axis=nothing},
y={ν[:,2],type="quantitative",axis=nothing},
width=600,
height=400,
size={ν_m,legend=nothing,type="q"})
然后,当我为边缘创建可视化并将所有内容绘制在一起时:
v3 = @vlplot(
mark={"type"=:line,color="black",clip=false},
data = df,
encoding={
x={"edges_x:q",axis=nothing},
y={"edges_y:q",axis=nothing},
opacity={"ew:q",legend=nothing},
size={"ew:q",scale={range=[0,2]},legend=nothing},
detail={"pe:o"}},
width=600,
height=400
)
@vlplot(view={stroke=nothing})+v3+v2+v1
关于为什么会发生这种情况以及如何解决它的任何想法? (注意,“scale”属性不是原因。即使我删除它,问题仍然存在)。
【问题讨论】:
标签: visualization scale vega-lite