Jake Zieve
Jake Zieve

Reputation: 455

ggplot: color,fill and size in geom_point

I simply want a scatterplot where each point is scaled by size and fill for different variables. I've read just about everywhere about this and I realize the default shape is hollow (I've changed it to 19, which is solid). I want the color and fill to be the same so each point has 1 color, 1 size, 1 x-y coord rather than the donut look its got going on. The separation of color and fill is frustrating me to no end... Here's the code:

ggplot(data, aes(period,freq))+
 geom_point(shape=19,aes(size=copies,fill=total_len,colour=total_len))+
 scale_fill_gradient(low="blue",high="red")+
 scale_colour_gradient(low="blue",high="red")

Upvotes: 2

Views: 10500

Answers (1)

Señor O
Señor O

Reputation: 17412

I think all you need is

ggplot(data, aes(period, freq, size=copies, color=total_len)) + 
   geom_point() + 
   scale_color_gradient(low="blue", high="red")

Upvotes: 2

Related Questions