Creating a subline in mtext

I have the following data file

Data1 <- data.frame(pH = c(8,8.5,6,7.1,9), EC50 = c(20,11,5,25,50)) Data2 <- data.frame(pH = c(7,7.2,6.5,8.2,8.5), EC50 = c(13,15,18,25,19)) 

Using par , I create two graphs on the same graph:

 par(mfrow=c(2,1), oma=c(3,3,1,1), mar=c(2,2,3,1), cex.axis=1.3) plot(x=Data1[,'pH'], y=Data1[,'EC50']) plot(x=Data2[,'pH'], y=Data2[,'EC50']) 

Since I used par , I cannot specify xlab and ylab in plot ,
so i am using mtext .
I would like to write an inscription in my ylab , however, I do not know how to do this,
when using mtext .

I tried the following

 mtext(expression("Cu^{2+} at EC50"), side=2, line = 4, padj=1, at=30, cex=1.2) 

but can't seem to get 2+ like up above Cu.

Any help is more than welcome!

+6
source share
2 answers

You must create your expression in the expression call. See Examples in Mathematical Abstract in R.

In your case, I found

 mtext(expression(paste( plain("Cu") ^ plain("2+"), plain(" at EC50") )), side=2, line = 4, padj=1, at=30, cex=1.2) 

gave a reasonable result

+3
source
 mtext(expression(paste("Cu"^"2+","at EC50",sep=""))) 
+3
source

Source: https://habr.com/ru/post/949815/


All Articles