简体   繁体   中英

subscript in axis label when using png() in base r plot

I understand how to make sub/super-scripts in axis labels in base r plot. My code works fine when sending the figure straight to the R Plots section in Rstudio. However, when I try to export my graph as png, using png() , the mtext() that contains a superscript disappears.

Below is the mtext() code that I use- this works fine when just plotting in the R Studio screen, but it disappears when exporting to png()

mtext(side = 1, cex = 1.5,  expression ("Net Change in SO "["4"] ^"2-" *" µeq/L"), line = 3)

Any suggestions would be greatly appreciated!

Most likely this happens because you need to adjust the line parameter.

Start by making it 0 (default):

mtext(side=1, cex=1.4, "some text", line=0)

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