hadley/ggplot2 — Issue #352: Missing legend and no warning when scale_shape is used with non-factor
Author: jrauser
Created: 2012-01-09 22:35:50+00:00
State: open

This produces a plot with no shape legend:

dat<-data.frame(x=runif(10),y=runif(10),type=sample(1:3,10,replace=TRUE))
ggplot(dat,aes(x,y,shape=type))+geom_point()

The trouble (of course) is that type isn't a factor. When we fix that everything works just fine:

dat<-transform(dat,type=factor(type))
ggplot(dat,aes(x,y,shape=type))+geom_point()

I'm not sure if the first block should refuse to produce a plot and print and error, or if it should make a plot and produce a warning.