Try this modification of your code.
-tgs
ynames <-
base.dat.sel2$base.dat.Covariate[order(base.dat.sel2$base.dat.US.Num.Obs.to.Achieve.Starting.Residual,decreasing=F)]
ynames <- as.character(ynames)
ynames[12]<-expression(theta[r])
ynames[13]<-expression(EC[gw])
ttt<-barplot(base.dat.sel2$base.dat.US.Num.Obs.to.Achieve.Starting.Residual[order(base.dat.sel2$base.dat.US.Num.Obs.to.Achieve.Starting.Residual,decreasing=F)],
names.arg=ynames,
col="grey",horiz=T,las=1,xlim=c(0,450),yaxs="i",cex.axis=1.2,cex.names=1.1)
On Wed, Dec 8, 2010 at 2:15 PM, emorway <emorway@engr.colostate.edu>
wrote:
>
> Hello,
>
> I've been looking through ?phantom and ?expression and this forum for
> examples of how I might be able to manipulate some of the names that appear
> on the y-axis of the barplot below. For example, the "gw" in
"ECgw" would
> appear as a subscript...or "qr" would be the theta symbol
followed by
> subscript "r". My attempts haven't even come close to what
I'm after. I
> could switch to ?text or ?mtext, but thought for positioning purposes it
> would be easier to do it with names.arg in the barplot function call.
>
> Thanks,
> Eric
>
>
> base.dat.sel2<-read.table(textConnection("base.dat.Covariate
> base.dat.US.Number.Observations
> base.dat.US.Num.Obs.to.Achieve.Starting.Residual
> base.dat.US.Percent.Reduction.in.EM38.Surveys
> base.dat.DS.Number.Observations
> base.dat.DS.Num.Obs.to.Achieve.Starting.Residual
> base.dat.DS.Percent.Reduction.in.EM38.Surveys
> Baseline 391 391 NA 281 281 NA
> WTD 391 315 0.194 281 210 0.253
> ECgw 391 362 0.074 281 280 0.004
> SM 391 349 0.107 281 280 0.004
> WTD_ECgw 391 300 0.233 281 209 0.256
> WTD_SM 391 286 0.269 281 210 0.253
> ECgw_SM 391 318 0.187 281 280 0.004
> WTD_ECgw_SM 391 269 0.312 281 210 0.253
> Sand 391 359 0.082 281 279 0.007
> Silt 391 369 0.056 281 280 0.001
> Clay 391 370 0.054 281 269 0.043
> WTD_ECgw_SM_Sand 391 263 0.327 281 181 0.356
> qr 391 360 0.079 281 270 0.038
> Ks 391 370 0.054 281 276 0.017
> qr_Ks 391 358 0.084 281 271 0.035
> WTD_ECgw_SM_qr 391 261 0.332 281 188 0.331
> WTD_ECgw_SM_Ks 391 260 0.335 281 205 0.270"),header=T)
> closeAllConnections()
>
> par(mar=c(3,15,2,1))
>
>
barplot(base.dat.sel2$base.dat.US.Num.Obs.to.Achieve.Starting.Residual[order(base.dat.sel2$base.dat.US.Num.Obs.to.Achieve.Starting.Residual,decreasing=F)],
>
>
>
names.arg=base.dat.sel2$base.dat.Covariate[order(base.dat.sel2$base.dat.US.Num.Obs.to.Achieve.Starting.Residual,decreasing=F)],
>
>
col="grey",horiz=T,las=1,xlim=c(0,450),yaxs="i",cex.axis=1.2,cex.names=1.1)
>
> --
> View this message in context:
>
http://r.789695.n4.nabble.com/Formatting-names-arg-in-barplot-tp3078861p3078861.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
[[alternative HTML version deleted]]