ggplot2: separate color scale per facet

Intuitively I'm looking for something like: facet_(scales="free_color")

I do something like

p <- ggplot(mpg, aes(year, displ, color=model)) + facet_wrap(~manufacturer)
p + geom_jitter()

That is: plot 2d measurements from individuals(model) belonging to different species(manufacturer) faceted by a species, indicating the individual by color. The problem is that all individuals share the same color scale - so that the points in a facet have very similar colors.

Using the group aesthetic with geom_line would solve the problem, but lines tell different story than dots.

Another obvious solution would be to drop the faceting and draw a separate plot for each subset. (If this should be the only solution: are there any quick, smart or proven ways to do that?)

17
задан ian 19 November 2010 в 01:28
поделиться