Question

How do you make just the x-lab label italics and NOT the y-lab label as well? The only command I can find (font.lab=3) makes both the x-lab and y-lab labels italics. I am creating barplots in R that have specific names on the x and y axis.

barplot(y, main="Main Title",
    names=c("a", "b", "c"),
    xlab="Text that I would like to be in italics",
    ylab="Text that I do NOT want to be in italics",
    font.lab=3)
Was it helpful?

Solution

 barplot(y, main="Main Title",
     names=c("a", "b", "c"),
     xlab=expression(italic("Text that I would like to be in italics")),
     ylab="Text that I do NOT want to be in italics")

That is a plotmath call:

?plotmath
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top