[R] A question about using function plot
Robert Baer
rbaer at atsu.edu
Mon Jul 14 18:43:50 CEST 2008
How about:
plot.default(factor(x), y, xaxt='n', xlab='x')
axis(1, at=factor(x), labels=x)
----- Original Message -----
From: "Jason Liao" <jg_liao at yahoo.com>
To: <r-help at r-project.org>
Sent: Monday, July 14, 2008 10:00 AM
Subject: [R] A question about using function plot
> Hello, everyone! I have spent two hours to get what I wanted in a simple
> situation and have not been successful. The set up is extremely simple
>
> x = c(1,2,4,8)
> y = c(1,2,3,4)
> plot(x, y)
>
> What I need, however, is for the 4 points of 1,2,4,8 to be spaced evenly,
> not by their numerical scale. Also, there should not be any other values
> such as 5,6,7 marked on the axis.
>
> So I tried the following
>
>
> x = c("1","2","4","8")
> y = c(1,2,3,4)
> plot(x, y)
>
> No help at all.
>
> Anyone can point me to the right way? Thank you very much.
>
> Jason
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list