Closed
Description
When having a composite ggplot with a data subset per layer setting scales = "free" gives an error.
What is fundamentally wrong with this approach ?
setting scales to fixed don't produce an error
require(ggplot2)
#> Loading required package: ggplot2
ggplot(mtcars, aes(mpg, disp)) + facet_grid(~cyl,scales="free") +
geom_point() +
geom_point(data = subset(mtcars, cyl == 4)) +
geom_line(data = subset(mtcars, cyl == 6)) +
geom_text(data = subset(mtcars, cyl == 8), aes(label = gear))
#> Error in scale_index[[i]]: subscript out of bounds
ggplot(mtcars, aes(mpg, disp)) + facet_grid(~cyl,scales="fixed") +
geom_point() +
geom_point(data = subset(mtcars, cyl == 4)) +
geom_line(data = subset(mtcars, cyl == 6)) +
geom_text(data = subset(mtcars, cyl == 8), aes(label = gear))
Created on 2019-01-24 by the reprex package (v0.2.1)
Metadata
Metadata
Assignees
Labels
No labels