[R] ggplot2: deterministic position_jitter & geom_line with position_jitter

Hadley Wickham hadley at rice.edu
Fri Jun 25 19:26:15 CEST 2010


> I'm having the same problem as Stephan (see below), but what I'm trying to
> jitter is not a numeric vector, but a factor. How do I proceed? (Naively
> jittering a factor makes it numeric, no longer factor, so I don't get the
> custom ordering which conveniently comes with using a factor. I'm not sure
> how I would simulate that custom ordering with the jittered vector ... I
> couldn't find anything online about jittering factors, but maybe I just
> wasn't searching cleverly enough.)

You'll probably need to reorder the factor, then jitter it, and then
add custom labels with scale_continuous().  I think I see how to
resolve this problem in general (two displays of the same jittered
data), but it requires basically a complete rewrite of ggplot2, so
it's unlikely to appear before ggplot3.

Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list