layer_points(): Is it possible to specify dot size by a factor variable?

33 views
Skip to first unread message

ying chen

unread,
Nov 14, 2014, 4:21:27 PM11/14/14
to gg...@googlegroups.com
Hi guys,

I just wonder if it's possible to specify dot size by a factor variable in layer_points()? For example:

df <- data.frame(x=1:5, y=1:5, z=c("Yes","Yes","No","Yes","No"))

I want to plot  x ~ y, but I also want to the dots have bigger size when z=="Yes"

Thanks a lot,

Ying

Ian Lyttle

unread,
Nov 14, 2014, 9:38:12 PM11/14/14
to gg...@googlegroups.com
Hi Ying,

I'd suggest you include a scale_nominal() function in your pipe. In this case, you would be setting it for the "size" property - the domain is the set of your possible values, i.e. "No", "Yes" - the range would correspond to the minimum and maximum area (in pixels) of the symbol.

Ian
Reply all
Reply to author
Forward
0 new messages