简体   繁体   中英

R: plot : variable title font size

I have a plot and have a chart title: ABCI would like the A to be small, B to be medium and C to be large. I tried:

plot(1:10,main=paste("A","B","C"),cex.main=c(0.5,1,1.5))

but this gives an error.

I would be grateful for your help in correcting the above.

cex.main only excepts one single value. But a possible solution would be mtext() instead of using the main parameter:

plot(1:10)
mtext(c("A","B","C"), 3, line=1.5, cex = c(1,2,3), at = c(4,5,6))

You can change the y position by adjusting the "line"-value and the x-position by adjusting "at".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM