Reputation: 243
I want to remove the size 20 legend on the right. Below is my code:
qplot(lingLocation[ind,ind_water_fountain]/lingLocation[ind,1],
lingLocation[ind,ind_soda]/lingLocation[ind,1],
color = lingLocation[ind,ind_frosting]/lingLocation[ind,1], size = 20) +
# opts(legend.position = "none") +
scale_colour_gradient("Frosting %", low = "blue", high = "red") +
ylab("Soda %") +
xlab("Water Fountain %")
Thanks!
Upvotes: 2
Views: 3587
Reputation: 58825
qplot
assumes that the size
specification is a mapping and so creates a scale. Here, you just want to set it to 20, so replace size = 20
with size = I(20)
. That sets the size and does not create a scale (and probably makes the points bigger than you anticipated).
Upvotes: 3
Reputation: 8717
Try removing the size=20
argument from the qplot
call, and stick it in a geom_point
call.
For example, change your code to this:
qplot(lingLocation[ind,ind_water_fountain]/lingLocation[ind,1],
lingLocation[ind,ind_soda]/lingLocation[ind,1],
color = lingLocation[ind,ind_frosting]/lingLocation[ind,1]) +
# opts(legend.position = "none") +
scale_colour_gradient("Frosting %", low = "blue", high = "red") +
ylab("Soda %") +
xlab("Water Fountain %") +
geom_point(size=20)
I don't use the qplot
function, but I think that should work. I believe ggplot2
adds a scale for every aesthetic call in each geom, which is what qplot
is probably doing. But since you are applying the size to all points, having the size parameter outside of the aes
should achieve the same effect, and the size=20
will not generate a legend for it (I think). And geom_point
should inherit the aesthetics from qplot
(I hope).
Let me know if this works!
EDIT:
I just tested it. Placing size inside geom_point
should work. However, the size settings from inside qplot
seem to differ from the size settings when called from geom_point
, so maybe setting a smaller size inside geom_point
should do the trick (say, geom_point(size=5)
)
Upvotes: 4