[R] Putting subscript in facet_grid label of ggplot

Harun Rashid mhrashidbau at yahoo.com
Fri Feb 12 04:41:22 CET 2016


Hello,
I am having trouble with putting subscript in facet_grid label. Here is 
an example of the work I have been trying to do.

 > 
df<-data.frame(species=gl(2,10,labels=c('sp1','sp2')),age=sample(3:12,40,replace=T),variable=gl(2,20,labels=c('N1P1 
var','N2P1 var')),value=rnorm(40))

 > 
test.plot<-ggplot(data=df,aes(x=age,y=value))+geom_point()+facet_grid(variable~species)

Now I want to make by vertical facet label as 'N[1]P[1] var' and so on, 
where the numbers in the squared bracket means subscript.
Thanks in advance for your  help.
Regards,
Harun
-- 

<mailto:mhrashidbau at yahoo.com>
<mailto:mhrashidbau at yahoo.com>

	[[alternative HTML version deleted]]



More information about the R-help mailing list