ggplot标题中的下划线大小增加

时间:2019-08-04 05:27:49

标签: r ggplot2

我正在尝试增加ggplot标题中下划线的大小/宽度/厚度。我尝试使用大小,宽度和长度,但是没有运气。

这是我所做的事的一个例子。

test <- tibble(x = 1:5, 
y = 1, 
z = x ^ 2 + y)

ggplot(test, aes(x,z)) +
geom_point() +
labs(title = expression(paste(underline("Increasing"), " underline")))+
theme(plot.title = element_text(size = 20))

enter image description here任何想法都会受到赞赏。

1 个答案:

答案 0 :(得分:5)

好问题。我对第一个想法的理解正确吗?

用下划线在下划线上加边框。

library(ggplot2)
library(tibble)

test <- tibble(x = 1:5, 
               y = 1, 
               z = x ^ 2 + y)

ggplot(test, aes(x, z)) +
  geom_point() +
  labs(title = expression(paste(underline(underline("Increasing")), " underline"))) +
  theme(plot.title = element_text(size = 20))

enter image description here