[英]scales = "free" has no effect on facet_grid
我想要 plot 数据,具体取决于季节和月份。 数据集大小各不相同,这就是为什么我要使用参数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"))
结果是:
如何使“Summer”行中的数据可见?
facet_grid
强制所有面图每行具有相同的 y 轴,每列具有相同的 x 轴。 这就是为什么它被称为网格。 您必须改用facet_wrap(Season ~ year, scales = "free")
以允许每个方面都有单独的 y 轴。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.