0

How can I keep the % symbol in the title?

library(ggtext)
library(ggplot2)

ggplot(mtcars, aes(cyl, mpg)) +
  geom_col() +
  ggtitle("%") +
  theme(plot.title = element_markdown())

Created on 2022-01-28 by the reprex package (v2.0.1)

John-Henry
  • 1,556
  • 8
  • 20

1 Answers1

1

You can just add a space before and the character will display correctly. Although there is a space, the formatting of the title will ignore this:

ggplot(mtcars, aes(cyl, mpg)) +
  geom_col() +
  ggtitle(" %") +
  theme(plot.title = element_markdown())

enter image description here

chemdork123
  • 12,369
  • 2
  • 16
  • 32