【问题标题】:ggplot few X-scale bold, rest not boldggplot 几个 X-scale 粗体,其余不粗体
【发布时间】:2014-07-14 08:22:31
【问题描述】:

我有一个 ggplot,x 刻度上的数字从 0 到 21。我希望数字 0、4、6、9、12、16、18 和 21 用粗体显示,其余的必须保持原样正常(灰色,非粗体)

我该怎么做?

【问题讨论】:

  • 这个问题似乎离题了,因为它没有显示任何研究工作。

标签: r ggplot2 xscale


【解决方案1】:

这是一个例子:

labels <- 1:5
highlight <- c(1, 3, 5)
ggplot(data.frame(x=1:5, y=1:5), aes(x=x, y=y)) + 
  geom_point() + 
  theme(axis.text.x=
          element_text(face=ifelse(labels %in% highlight, "bold", "plain"), 
                      colour=ifelse(labels %in% highlight, "blue", "grey50"), size=25))

【讨论】:

  • 然后用粗体和蓝色表示?
  • @AnnWulleman 在element_text 的帮助页面上查看编辑并查看其他可控参数。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-08-21
  • 1970-01-01
  • 2017-01-20
  • 2012-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多