I want to plot data depending on season and month. The dataset-size varies, thats why I want to use the parameter scales = "free"
.
cp <- coord_polar(start = -((dirres/2)/360) * 2 * pi, dir = 1)
cp$is_free <- function() TRUE
plot <- ggplot(data = data, aes(x = dir.binned, fill = spd.binned)) +
geom_bar() +
cp +
facet_grid(Season ~year, scales = "free_y") +
theme(strip.text.x = element_text(size=8, angle=75),
strip.text.y = element_text(size=12, face="bold"),
strip.background = element_rect(colour= "white", fill= "#CCCCFF")) +
scale_x_discrete(drop = FALSE, labels = c("N", "NE", "E", "SE", "S", "SW", "W", "NW")) +
theme(text = element_text(size = 22)) +
theme(panel.spacing = unit(0.5, "cm")) +
theme(axis.title.x = element_blank()) +
theme(axis.title.y = element_text(vjust = 4)) +
theme(legend.position = "right") +
theme(plot.margin = unit(c(3,3,3,3), "cm"))
results in:
How could I make the data from row "Summer" visible?
facet_grid
enforces all facet plots to have the same y axis per row and the same x axis per column. This is why it's called a grid. You have to use facet_wrap(Season ~ year, scales = "free")
instead to allow having separate y axes for each facet.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.