Reputation: 2415
I am looking for a way to increase or decrease the all the points in the graph below with a factor. I can control the within the aes. And I can control the size outside aes. But I can't figure out how to combine both.
df <- data.frame(val1 = rnorm(10, 5), val2 = rnorm(10, 5), size = rnorm(10, 5))
ggplot(df) + geom_point(aes(val1, val2, size = size))
Thanks in advance for your time.
Upvotes: 12
Views: 10875
Reputation: 60462
You can change the base sizes using the scale_size_
function. For example,
g = ggplot(df) + geom_point(aes(val1, val2, size = size))
g + scale_size_continuous(range = c(1, 6))
g + scale_size_continuous(range = c(1, 18))
Upvotes: 25