How to increase font size in a plot in R?

前端 未结 7 1412
小鲜肉
小鲜肉 2020-11-28 01:21

I am confused. What is the right way to increase font size of text in the title, labels and other places of a plot?

For example

x <- rnorm(100)
h         


        
7条回答
  •  悲哀的现实
    2020-11-28 01:55

    Thus, to summarise the existing discussion, adding

    cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5

    to your plot, where 1.5 could be 2, 3, etc. and a value of 1 is the default will increase the font size.

    x <- rnorm(100)
    

    cex doesn't change things

    hist(x, xlim=range(x),
         xlab= "Variable Lable", ylab="density", main="Title of plot", prob=TRUE)
    
    hist(x, xlim=range(x),
         xlab= "Variable Lable", ylab="density", main="Title of plot", prob=TRUE, 
         cex=1.5)
    

    enter image description here

    Add cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5

    hist(x, xlim=range(x),
         xlab= "Variable Lable", ylab="density", main="Title of plot", prob=TRUE, 
         cex.lab=1.5, cex.axis=1.5, cex.main=1.5, cex.sub=1.5)
    

    enter image description here

提交回复
热议问题