AlgebraOfGraphics.jl: Combine mappings & data with different unnamed arguments

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: JuliaLang

This may be fixed on AOG#master:

1 Like

Indeed! Thanks a lot. This is solved also for my “real” problem! Will this (whatever change it was) be in the next release?

@piever we should be able to tag this pretty quickly, right?

Sure, there are a bunch of unreleased fixes on master, I’ll tag a new version tomorrow.

UPDATE: the new release was just merged, so on latest release this should be fixed