I have a problem that would be extremely easy to solve in ggplot
, but can´t figure out how to make it work in corrplot
. How to make y-axis labels in italics??
library(corrplot)
M <- cor(mtcars)
corrplot(M, method="circle")
CodePudding user response:
If you use font = 3
it will italicize all the axes. If you only want the Y axis, a workaround is:
par(mar = c(4, 6, 4, 4))
temp <- corrplot(M, method = "circle", font = 3, tl.pos='n',
mar = c(0, 0, 4, 0))
mtext(unique(temp$corrPos$yName),
at = unique(temp$corrPos$y), side = 2, las = 1,
font = 3)
mtext(unique(temp$corrPos$xName),
at = unique(temp$corrPos$x), las = 2)
Though may need some tweaking of the margins on your end to line things up.
CodePudding user response:
In corrplot
, there is a ...
argument which allows extra parameters to be passed to the base R text
function. Since text
has a font
parameter, where the value 3 means italics, you can do:
library(corrplot)
M <- cor(mtcars)
corrplot(M, method="circle", font = 3)