[英]ggplot2: classic plot with black labels for x and y axis
I am trying to plot data with a classic look and black axis labels.我正在尝试使用经典外观和黑色轴标签绘制数据。 Yet, theme_classic has two different shades of grey for the axis tick labels and the ticks.
然而,theme_classic 对于轴刻度标签和刻度有两种不同的灰色阴影。
Using the mtcars dataset and p1 as listed in ?theme_classic I tried使用 ?theme_classic 中列出的 mtcars 数据集和 p1 我试过
p1 + theme_classic(axis.text.x = element_text(colour="black"))
but this just works with theme not theme_classic.但这仅适用于主题而不是 theme_classic。
Is there a way to get black axis ticks and labels without having to specify a classic theme from scratch?有没有办法获得黑轴刻度和标签而不必从头开始指定经典主题?
You need to add customizations to theme()
calls after theme_classic()
.您需要在
theme_classic()
之后为theme()
调用添加自定义。 Try:尝试:
p1 + theme_classic() +
theme(
axis.text.x = element_text(color="black"),
axis.ticks = element_line(color = "black")
)
The only arguments theme_***()
functions typically take are base size and family related arguments. theme_***()
函数通常采用的唯一参数是基本大小和与系列相关的参数。 Additional customization is done through plain theme()
.额外的定制是通过普通的
theme()
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.