[R] help with subscript on axis lables

Adams, Jean jvadams at usgs.gov
Fri Oct 3 14:21:38 CEST 2014


Andras,

There may be an easier way to do this, but this works.

vals <- 1:5
names(vals) <- paste0("ke",1:length(vals))
mp <- barplot(vals, ylim = c(0, 6), ylab=expression(Hour^-10), names.arg="")
sapply(vals, function(i) axis(1, at=mp[i], substitute(list(ke[x]),
list(x=i)), tick=FALSE))

Jean

On Fri, Oct 3, 2014 at 6:15 AM, 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]]
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list