-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Description
By default, interior facets are not drawn with axis ticks or labels.
library(ggplot2)
df <- data.frame(
x = rnorm(900),
y = rnorm(900),
a = rep(letters[1:9], each = 10)
)
ggplot(df, aes(x, y)) +
geom_point() +
facet_wrap(vars(a))
However, if we set scales = "free"
, we do get per-facet axis ticks and labels, but now each facet also has its own scale range.
ggplot(df, aes(x, y)) +
geom_point() +
facet_wrap(vars(a), scales = "free")
I find that it's often desirable to have fixed scales but have each facet have its own axis annotations. This can currently be achieved by setting scales = "free"
but then manually setting the scale limits.
ggplot(df, aes(x, y)) +
geom_point() +
facet_wrap(vars(a), scales = "free") +
xlim(-4, 4) + ylim(-4, 4)
I think it would be a good idea to add an option that draws axis annotations for all facets even if scales are fixed. I routinely wish I had this option.
bschneidr, teunbrand, AARON-CLARK, iagogv3, agilebean and 8 moreagilebeanagilebean