support for panel.vars in ylayer
tverbeke opened this issue · comments
The example below is a bit artificial, but I can imagine situations where different panel.vars in different layers are useful:
- two data sources where the x and y variables have different names
- a layer where there is no explicit y variable (e.g. a histogram) followed by a layer where specification of a y variable is desirable (e.g. for annotating the histogram).
library(yagpack)
if (interactive()) x11() else pdf()
.yagpenv$backend <- graphics_primitives()
dataFrame <- data.frame(x = c(1, 2, 2, 3),
y = c(1, 1, 2, 3),
g1 = factor(c("A", "B", "A", "B")),
g2 = factor(c("B", "A", "A", "B")))
p <- yplot(data = dataFrame,
panel.vars = elist(x = x, y = y, groups = g1),
panel = ylayer(mapping = map_points(), render = render_lines()) +
ylayer(mapping = map_points(), render = render_lines(),
panel.vars = elist(x = x, y = y, groups = g2)))
p
- example above now works as expected
- histogram scenario also works
- scenario with different names also works
thanks!