How can I use bold, italic and underline in a graphic title or axis in ggplot2?
Asked
Active
Viewed 2,758 times
-1
-
1Does this answer your question? [How to underline text in a plot title or label? (ggplot2)](https://stackoverflow.com/questions/30470293/how-to-underline-text-in-a-plot-title-or-label-ggplot2) – Sinh Nguyen May 12 '21 at 13:18
-
@SinhNguyen it isn't enough because I want bolda and italic. – ramgouveia May 12 '21 at 13:28
-
You may be interested in package **ggtext** – aosmith May 12 '21 at 14:23
1 Answers
1
Here is the trial with the links I shared in comment - Not sure what you want to achieve though
data <- data.frame(x = runif(10), y = runif(10))
library(ggplot2)
ggplot() +
geom_point(data, mapping = aes(x, y)) +
ggtitle(expression(atop(paste(bold("Bold "), italic(" italic"),
underline(" underline"),
underline(bold(" underline can go with bold")),
underline(italic(" or italic"))),
paste(bolditalic(" - and italic & bold together"),
underline(bolditalic(" - and all together"))))))
Created on 2021-05-12 by the reprex package (v2.0.0)

Sinh Nguyen
- 4,277
- 3
- 18
- 26