Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a superscript in mtext

Tags:

r

I have the following dataframe

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 one plot:

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'])

Because I used par, I cannot specify the xlab and ylab in plot,
therefore I use mtext.
I would like to write a superscript in my ylab, however, I do not know how to do so,
when using mtext.

I have 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 the 2+ as a superscript above the Cu.

Any help is more than welcome!

like image 769
Tina Van Regenmortel Avatar asked Jul 19 '13 10:07

Tina Van Regenmortel


1 Answers

mtext(expression(paste("Cu"^"2+","at EC50",sep="")))
like image 72
user1317221_G Avatar answered Oct 04 '22 21:10

user1317221_G