How do you make just the x-lab label italics and NOT the y-lab label as well? (in R)

StackOverflow https://stackoverflow.com/questions/8975909

سؤال

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)
هل كانت مفيدة؟

المحلول

 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
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top