[R] binary scatterplot

Michael A. Miller mmiller3 at iupui.edu
Mon Feb 3 21:26:03 CET 2003


>>>>> "Michael" == Michael Lynn Fugate <fugate at trinidad.c3.lanl.gov> writes:

    > Hi, When I use the function plot() to plot a categorical
    > variable with two levels versus a continuous variable, the
    > two levels of the categorical variable are plotted at the
    > values of 1.0 and 2.0.  I would like them to be plotted at
    > the values of 0.0 and 1.0.  How can I do this?

This is not quite what you are asking for, but it might serve
just as well:

> x <- 1:10
> y <- as.factor(rep(c("A","B"),c(5,5)))
> dotchart(x,groups=y)

or

> require(lattice)
> df<-data.frame(x,y)
> stripplot(y~x, data=df) 

or

> require(lattice)
> df<-data.frame(x,y)
> dotplot(y~x, data=df)

Mike




More information about the R-help mailing list