[英]facets as in facet_grid, and axis.line as for facet_wrap?
我正在嘗試使用 facets 構建一個繪圖,如facet-grid ,因此使用兩個因素在 x 和 y 軸上分開繪圖,如下所示:
mtcars %>% ggplot() +
geom_point(aes(x=mpg, y=wt)) +
facet_grid(cyl ~ gear, scales="free") +
theme(panel.background = element_blank(), axis.line = element_line(size=0.5))
上述方法的問題是只顯示了最上圖和最左圖的軸線,因此在不使用彩色panel.background
情況下很難區分圖。
facet-wrap不會出現此問題,但此函數顯然不會對兩個軸中的因素進行分組,或者條帶將始終位於一側(根據strip.position
參數),但不會向上和向右facet_grid
。 例如:
mtcars %>% ggplot() +
geom_point(aes(x=mpg, y=wt)) +
facet_wrap(cyl ~ gear, scales="free") +
theme(panel.background = element_blank(), axis.line = element_line(size=0.5))
問題是否可以使用facet_grid
創建繪圖,但在所有軸上都有線條,或者使用facet_wrap
,但與facet_grid
一樣對因子進行facet_grid
?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.