babaq
January 14, 2020, 3:30am
1
I want to draw a scatter plot but use different point shape and angles to show different orientations and directions.
the stroke
shape and arrow
shape seems what I want, but I am have trouble to make it work
function foo(pos;ori=0,dir=90)
data1 = DataFrame(x=pos[:,1],y=pos[:,2],shape=1,angle=ori)
data2 = DataFrame(x=pos[:,1],y=pos[:,2],shape=2,angle=dir)
data = [data1;data2]
data |> @vlplot(
mark={:point,filled=true,strokeWidth=4},
encoding={
x=:x,y=:y,shape={"shape:n",scale={domain=[1,2],range=[:stroke,:arrow]}},size={"shape:n",scale={domain=[1,2],range=[200,400]}},
angle="angle:q"
},
width=400,height=400 )
end
up = [1:10 3:12]
p=foo(up)
the Vega-Lite says angle is not a valid encoding channel but I saw this .
any suggestions would be appreciated.
This is the same question as here , right? No need to post twice
EDIT: Sorry I originally used the wrong link here. I think this was the same question that was already asked on github?
1 Like
oheil
January 14, 2020, 10:30am
3
Strange, your link to the “other” post points exactly to this post here, and I can’t find the duplicate one.
I hesitate to answer the OP because it may be already answered in the “other” duplicate.
oheil
January 14, 2020, 10:34am
4
“angle” is not supported by VegaLite, see here:
https://github.com/vega/vega-lite/issues/4270
You may try to use Vega syntax (JSON) as in your linked example. On how to use this in Julia can be read here:
https://www.queryverse.org/VegaLite.jl/stable/userguide/vega/
You may also consider to use VegaLite#master where Vega support has been slightly improved:
https://www.queryverse.org/VegaLite.jl/dev/userguide/vega/
1 Like
VegaLite.jl now supports the angle
encoding channel, see this example .