[R] ticks labels and R
Marc Schwartz
marc_schwartz at comcast.net
Sun Mar 18 18:38:52 CET 2007
On Sun, 2007-03-18 at 19:36 +0300, Eugene Semenko wrote:
> Hi,
> I have plot a graphics by next way:
> par(mar=c(5,5,1,1), font.axis=3, ps=14, xaxs="i", yaxs="i", lab=c(18,18,7),
> font
> .lab=3);
> plot(l, b, type="n", xlim=c(0,360), ylim=c(-90,90), xlab="l, deg", ylab="b,
> deg");
> points(l, b, cex=vel/60, col=1, pch=21);
>
> On this plot I have axis x (denoted by l) ranged in [0,360] with labeling step
> 20. But I want to set this step equal to 60 and want to set format of labels
> to degrees. I'm newbie in R and don't know how to change parameters of axis.
> Especially important to add sign of degree to each tick label.
> Thanks in advance,
Eugene, see ?plotmath for more information.
at <- seq(-360, 360, 60)
plot(at, at, axes = FALSE)
# Now create expressions with the degree symbol
# See ?parse and ?paste
L <- parse(text = paste(at, "*degree", sep = ""))
> L
expression(-360 * degree, -300 * degree, -240 * degree, -180 *
degree, -120 * degree, -60 * degree, 0 * degree, 60 * degree,
120 * degree, 180 * degree, 240 * degree, 300 * degree, 360 *
degree)
# now do the axis labels
axis(1, at = at, labels = L, cex.axis = 0.75)
axis(2, at = at, labels = L, cex.axis = 0.75, las = 2)
See ?axis as well.
HTH,
Marc Schwartz
More information about the R-help
mailing list