我正在尝试使用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“属性不是原因。即使我删除了它,问题仍然存在)。
发布于 2020-11-17 02:58:20
当渲染复合图表时,Vega-Lite默认使用共享比例(参见https://vega.github.io/vega-lite/docs/resolve.html):当您的size比例在线状图和圆形图之间共享时,它会导致较差的结果。
我不熟悉VegaLite.jl语法,但您希望在顶层图表中使用的JSON规范是:
"resolve": {"scale": {"size": "independent"}}https://stackoverflow.com/questions/64863681
复制相似问题