I want to share some mappings (e.g. color, col) between two datasets and two visuals, but the number of unnamed inputs to the visuals is different. A simplified version without any shared mappings:
d1 = (;segments=[Rect(Vec(0,1),Vec(1,2)) for x in 1:10])
d2 = (;x=1:6,y=1:6)
pl1 = data(d1)*mapping(:segments)*visual(Poly)
pl2 = data(d2)*mapping(:x,:y)*visual(Lines)
pl1+pl2|>draw
I expected a rectangle + a straight line on top, but I got the error ERROR: ArgumentError: segments and x must be equal
Obviously I cannot use the same mapping (as in an example in the documentation) because the number of input arguments is different for the two visuals*. If I rename :segments
to :x
, I get the error:
ERROR: MethodError: no method matching rescale(::Vector{GeometryBasics.HyperRectangle{2, Int64}}, ::AlgebraOfGraphics.ContinuousScale{Int64, typeof(identity)})
Any pointers would be appreciated
* I get the same problem for “Band” (x,y,low,high) and “Line” (x,y) to plot errorbars
Also asked in Zulip: Zulip