[英]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.