Greek letters with subscript numbers on x-axis
You can use labels=as.expression(lapply(1:9, function(i)bquote(hat(lambda)[.(i)]))) Bill Dunlap TIBCO Software wdunlap tibco.com
On Wed, Jun 3, 2015 at 12:39 PM, Frank S. <f_j_rod at hotmail.com> wrote:
Hi everyone, I have allocated greek letters with subscript numbers on
x-axis of my R plot this way:
plot(10:18, 30:38, lwd=2, xlim=c(10,18), ylim=c(30,38), xaxt="n",
xlab="weights", ylab="value")
points(10:18, 30:38, pch=19)
axis(1, at=10:18, labels=c(expression(hat(lambda)[1]),
expression(hat(lambda)[2]), expression(hat(lambda)[3]),
expression(hat(lambda)[4]),expression(hat(lambda)[5]),expression(hat(lambda)[6]),
expression(hat(lambda)[7]),expression(hat(lambda)[8]),expression(hat(lambda)[9])),
padj = 0.25) However, as you see in the last lines, it's not an efficient
code. I think it could be done more efficiently with a loop. I've searched
about this question and I've found some very similar question, but the
given answer does not work (with do.call and lapply). Maybe another
functions like substitute or parse. Does anybody can help me? Thanks a
bunch!! Frank S.
[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.