的theme
元素axis.text
當前文檔說:ggplot2主題:axis.text不是從文本繼承?
axis.text
沿軸刻度標記(element_text;從文本繼承)
但似乎繼承不加工。
此代碼給出下圖,軸文本爲灰色。
library(ggplot2)
ggplot(data.frame(x=1:10, y=1:10), aes(x, y)) +
geom_point(color='red') +
theme(rect = element_rect(fill = 'black'),
line = element_line(color = 'white'),
text = element_text(color = 'blue'),
panel.background = element_blank())
設置axis.text
明確的作品,但我期待代碼片段已經產生這樣的結果
ggplot(data.frame(x=1:10, y=1:10), aes(x, y)) +
geom_point(color='red') +
theme(rect = element_rect(fill = 'black'),
line = element_line(color = 'white'),
text = element_text(color = 'blue'),
# *** setting this explictly ***
axis.text = element_text(color = 'blue'),
panel.background = element_blank())
我從一個全新的R對話開始,與此sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_2.2.0
loaded via a namespace (and not attached):
[1] labeling_0.3 colorspace_1.2-6 scales_0.4.1 assertthat_0.1 lazyeval_0.2.0
[6] plyr_1.8.4 tools_3.3.1 gtable_0.2.0 tibble_1.1 Rcpp_0.12.6
[11] grid_3.3.1 munsell_0.4.3
如何指定高級主題元素並讓這些設置通過繼承級聯下來?我需要以某種方式「清除」默認主題嗎?