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

**URL:** <https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258>\
**Category:** General Usage\
**Tags:** algebraofgraphics\
**Created:** [July 8, 2021, 8:33am UTC](https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258 "2021-07-08T08:33:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![behinger](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@behinger](https://discourse.julialang.org/u/behinger)\
**Post date:** [July 8, 2021, 8:33am UTC](https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258/1 "2021-07-08T08:33:32Z")

</div>

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:

```julia
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](http://juliaplots.org/AlgebraOfGraphics.jl/stable/generated/gallery/#Adding-traces-to-only-some-subplots)) 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](https://julialang.zulipchat.com/#narrow/stream/228276-makie.2Ejl/topic/AlgebraOfGraphics.2Ejl.3A.20Combine.20mappings.20.26.20datasets.20with.20di.2E.2E.2E)

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 8, 2021, 8:46am UTC](https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258/2 "2021-07-08T08:46:59Z")

</div>

This may be fixed on AOG#master:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/9/191d17db50b60d10d745344b7b624420fa3fa378.png)

---

<div class="post-metadata">

**Author:** ![behinger](https://avatars.discourse-cdn.com/v4/letter/b/7ba0ec/32.png) [@behinger](https://discourse.julialang.org/u/behinger)\
**Post date:** [July 8, 2021, 11:12am UTC](https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258/3 "2021-07-08T11:12:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 8, 2021, 11:27am UTC](https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258/4 "2021-07-08T11:27:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [July 8, 2021, 8:52pm UTC](https://discourse.julialang.org/t/algebraofgraphics-jl-combine-mappings-data-with-different-unnamed-arguments/64258/5 "2021-07-08T20:52:25Z")

</div>

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
