Irrelevant legend information in ggplot2

Posted by Dan Goldstein on Stack Overflow See other posts from Stack Overflow or by Dan Goldstein
Published on 2010-06-01T23:42:34Z Indexed on 2010/06/02 0:13 UTC
Read the original article Hit count: 592

Filed under:
|
|

When running this code (go ahead, try it):

library(ggplot2)
(myDat <- data.frame(cbind(VarX=10:1, VarY=runif(10)), 
    Descrip=sample(LETTERS[1:3], 10, replace=TRUE)))
ggplot(myDat,aes(VarX,VarY,shape=Descrip,size=3)) + geom_point()

... the "size=3" statement does correctly set the point size. However it causes the legend to give birth to a little legend beneath it, entitled "3" and containing nothing but a big dot and the number 3.

This does the same

ggplot(myDat,aes(VarX,VarY,shape=Descrip)) + geom_point(aes(size=3)) 

Yes, it is funny. It would have driven me insane a couple hours ago if it weren't so funny. But now let's make it stop.

© Stack Overflow or respective owner

Related posts about r

    Related posts about ggplot2