[R] Graphing question/possibly lattice/xyplot

Deepayan Sarkar deepayan at stat.wisc.edu
Thu Mar 3 00:29:10 CET 2005


On Wednesday 02 March 2005 16:24, Erin Hodgess wrote:
> Dear R People:
> I have a data frame with the variables calories, sodium and "type",
> where type is either zero or one.
>
> I would like to produce a scatterplot with sodium on the horizontal,
> calories on the vertical and have the dots be clear when type is one
> and black when type is zero.
>
> It can be done via lines and points, but I was wondering if there is
> a better way with lattice graphics.

How about something like

xyplot(calories ~ sodium, 
       groups = type, 
       col = 'black',
       pch = c(16, 1))

? 

-Deepayan




More information about the R-help mailing list