[R] help with subscript on axis lables

peter dalgaard pdalgd at gmail.com
Fri Oct 3 14:22:39 CEST 2014


On 03 Oct 2014, at 13:15 , Andras Farkas <motyocska at yahoo.com> wrote:

> Dear All,
> wonder if you could help with the following:we have:vals <- 1:5names(vals) <- paste0("ke",1:length(vals))mp <- barplot(vals, ylim = c(0, 6),ylab=expression(paste("Hour"^"-10")))
> 
> In would like to make the numbers (ke1 to ke5, respectively) in the labels of the x axis a subscript. There is plenty info on making subscripts in the title of the axis (ie: xlab=expression(...)), but was unable to find directions for my problem... Appreciate your help,
> Andras
> 	[[alternative HTML version deleted]]

Some ideas:

e <- as.expression(lapply(as.double(1:5), function(i)bquote("ke"[.(i)])))
plot(1:5, xaxt="n")
axis(1, at=1:5, labels=e)

barplot(rpois(5, 5), names=e)


> 
> ______________________________________________
> R-help at 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list