如果满足条件,我想更改 ggplot 中 x 轴文本的颜色。没问题,但为此,我必须知道theme_minimal(). 我查看了源代码,theme_bw()这让我theme_grey()找到了你可以在这里找到的源代码:https : //github.com/tidyverse/ggplot2/blob/master/R/theme-defaults.r
我看到许多声明颜色但不是其中之一x-axis?
You can use ggplot2 package's calc_element() to figure out what you want. In this case, the default font colour for x-axis text is "grey30":
> calc_element("axis.text.x", theme_minimal())
List of 11
$ family : chr ""
$ face : chr "plain"
$ colour : chr "grey30"
$ size : num 8.8
$ hjust : num 0.5
$ vjust : num 1
$ angle : num 0
$ lineheight : num 0.9
$ margin : 'margin' num [1:4] 2.2pt 0pt 0pt 0pt
..- attr(*, "valid.unit")= int 8
..- attr(*, "unit")= chr "pt"
$ debug : logi FALSE
$ inherit.blank: logi TRUE
- attr(*, "class")= chr [1:2] "element_text" "element"
Run Code Online (Sandbox Code Playgroud)