Hi
Is it possible to plot values against strings, i.e. the x axis has people's
names and the
y axis as values, as shown below:
5 x
4 x x
3 x
2 x
1
0
Dave Tim Ian Steve Paul
Sorry if this is a little primitive, but I think it gets the point across.
regards
Danny
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi
Is it possible to plot values against strings, i.e. the x axis has people's
names and the
y axis as values, as shown below:
5 x
4 x x
3 x
2 x
1
0
Dave Tim Ian Steve Paul
Sorry if this illustration is a little primitive, but I think it gets the
point across.
regards
Danny
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Suppose
y <- c(5:2,4)
names(y) <- c("Dave", "Tim", "Ian",
"Steve", "Paul")
Here are 3 possibilities which are close to what you want:
dotchart(y) <-- axes are switched from what you specified
plot(as.table(y)) <-- uses vertical bars rather than points
plot( y ~ factor(names(y),levels=names(y)), boxwex = .05) <-- not so pretty
On 3 Apr 2002 at 11:26, Danny Ruttle wrote:
> Hi
>
> Is it possible to plot values against strings, i.e. the x axis has
people's
> names and the
> y axis as values, as shown below:
>
>
> 5 x
> 4 x x
> 3 x
> 2 x
> 1
> 0
> Dave Tim Ian Steve Paul
>
> Sorry if this is a little primitive, but I think it gets the point across.
>
> regards
> Danny
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
>
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On 3 Apr 2002 at 18:12, Christophe Declercq wrote:> > > > Suppose > > > > y <- c(5:2,4) > > names(y) <- c("Dave", "Tim", "Ian", "Steve", "Paul") > > > stripchart(y~names(y), vertical=TRUE)Note that this rearranges the order of the elements on the x axis. If maintaining this order is important then use: ynames <- factor( names(y), levels = names(y) ) stripchart( y ~ ynames, vertical=TRUE ) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks to all those who chipped in to help. The snippet below solved the problem. regards Danny At 08:09 03/04/2002 -0500, Chuck Cleland wrote:>Danny Ruttle wrote: > > Is it possible to plot values against strings, i.e. the x axis has people's > > names and the > > y axis as values, as shown below: > >Danny: > >mynames <- c("Dave", "Tim", "Ian", "Steve", "Paul") >y <- runif(5) >plot(1:5, y, xaxt="n") >axis(side=1, at=1:5, mynames) > >Hope this helps, > >Chuck-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._