[R] plot

Rene Braeckman RMan54 at cox.net
Mon Dec 18 22:48:14 CET 2006


You can do something like this for a scatter plot:

x <- c("a","b","c")
y <- c(1,2,3)

xnum <- rep(1:length(x))
plot(x=xnum, y=y, xlab="x", xaxt="n")
axis(side=1, at=xnum, labels=x)

This fakes a numerical axis and suppresses the y-axis labels that you then
draw with the axis function the way that you want them. If you play with the
xnum vector, you can have different spacing of the points in the
x-direction.

Rene

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of XinMeng
Sent: Monday, December 18, 2006 1:03 AM
To: r-help at stat.math.ethz.ch
Subject: [R] plot

Hello sir:
a data with 2 columns:
id x
a  1
b  2
c  3

I wanna get such kind of plot:
x: a b c
y:1 2 3

But the plot command doesn't permit string character as x.

How can I get it ?

Thanks a lot !

My best

______________________________________________
R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list