When I submitted a paper to a journal, the journal asked me to set the font size to 7.5, however when I used the following code, only the axis text changed, the label size remained unchanged,
library(ggplot2)
library(FactoMineR)
library(factoextra)
irispca <- PCA(iris,quali.sup = 5)
fviz_pca_var(irispca)+
theme(text = element_text(size = 7.5),
axis.title = element_text(size = 7.5),
axis.text = element_text(size = 7.5)
)
Any suggestion is appreciated to tell what code should I used to change the label size?
To change the font size in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-size. HTML5 do not support the <font> tag, so the CSS style is used to add font size.
xlabel(___, Name,Value ) modifies the label appearance using one or more name-value pair arguments. For example, 'FontSize',12 sets the font size to 12 points.
Getting into fviz_pca_var
looks like you can just pass a labelsize in the function:
irispca <- PCA(iris,quali.sup = 5)
fviz_pca_var(irispca, labelsize = 3, repel = TRUE) +
theme(text = element_text(size = 7.5),
axis.title = element_text(size = 7.5),
axis.text = element_text(size = 7.5))
The argument labelsize is passed as an aditional argument to the fviz()
function. If you then go to the fviz
help page, the argument is there.
I would rather add a comment to the above answer but I do not have the required reputation so pardon me...
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