I'm wondering if anyone can help me. I have plotted the following graph:
visreg(MOD.1, xlab="Distance (m)", ylab="Sciurus vulgaris (Presence/Absence)",
xvar="Distance")
And I would like to make just 'Sciurus vulgaris' in italics. Can anyone help?
Thank you!
To write text in italic font, use a single underscore or asterix before and after the text. To write text in bold font, use a double asterix or underscores before and after the text.
Key ggplot2 R functionsp + xlab(“New X axis label”): Change the X axis label. p + ylab(“New Y axis label”): Change the Y axis label. p + labs(x = “New X axis label”, y = “New Y axis label”): Change both x and y axis labels.
Variables are italicized. Superscript numbers are not italicized (e.g., R2). Identifiers (which can be superscript or subscript words, letters, or numbers) are not italicized.
Change main title and axis labelsmain: the text for the main title. xlab: the text for the x axis label. ylab: the text for y axis title. sub: sub-title; It's placed at the bottom of x-axis.
Using the example from the documentation of ?visreg
I think the functions expression
and italic
will give you what you need:
fit <- lm(Ozone ~ Solar.R + Wind + Temp,data=airquality)
visreg(fit, xlab="Distance (m)",
ylab=expression(italic("Sciurus vulgaris ") (Presence/Absence)))
Output:
As you can see the y-axis label (only the "sciurus vulgaris") is in italics
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With