我最近安裝了cowplot
包。但是,這樣做後,我注意到我的ggplots錯過了他們的背景和網格線theme_grey()
!Cowplot使ggplot2主題消失/如何看當前ggplot2主題,並恢復默認?
創建的每個上述地塊的代碼是:
result_df %>%
ggplot(aes_string(x = 'p', y = 'r')) +
# theme_grey() + # uncomment this line to produce plot on right
geom_point(aes(group = c), size = 0.5) +
geom_line(aes(group = c), size = 0.2, linetype = 'dotted') +
theme(axis.text.x=element_text(angle = 90, hjust = 1, vjust = 0.5)) +
facet_grid(b ~ e, scales = "free_y") +
scale_x_continuous(breaks = seq(0, 10, 2))
沒有顯式調用+ theme_grey()
,我得到左邊的情節。
這裏發生了什麼?我認爲theme_grey()
是默認值。我如何看到我的默認主題是?
這裏是我的sessionInfo()
片段:
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggthemes_3.3.0 cowplot_0.7.0 RPostgreSQL_0.4-1 DBI_0.5-1 knitr_1.15.1 dirmult_0.1.3-4 dplyr_0.5.0
[8] purrr_0.2.2 readr_1.0.0 tidyr_0.6.0 tibble_1.2 ggplot2_2.2.0 tidyverse_1.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.8 magrittr_1.5 munsell_0.4.3 colorspace_1.3-1 R6_2.2.0 stringr_1.1.0 plyr_1.8.4 tools_3.3.2
[9] grid_3.3.2 gtable_0.2.0 lazyeval_0.2.0 assertthat_0.1 crayon_1.3.2 reshape2_1.4.2 rsconnect_0.6 testthat_1.0.2
[17] labeling_0.3 stringi_1.1.2 scales_0.4.1
cowplot認爲這是一個好主意,改變默認的主題附着 – baptiste
感謝的時候,非常有幫助。那麼,我如何查看默認主題並將其更改回來? :) – Alex
set_theme(theme_grey())? –