Search code examples
rstringplotformattingboxplot

How do I make text bold AND italics at same time in base R plot?


Let's say I have a plot:

plot(1:5,1:5, main = "Plot Title here")

How do I make my main title both bold and italic?

I can make it bold or italic, but I've been unable to acheive both simultaneously.

main = expression(italic("Plot Title here"))          #makes italic
main = expression(bold("Plot Title here"))            #makes bold
main = expression(bold(italic("Plot Title here")))    #still only makes italic!

Solution

  • From ?plotmath:

    main = expression(bolditalic("Plot Title here"))   
    plot(1:5,1:5, main = main)
    

    Created on 2023-04-03 with reprex v2.0.2