Reputation: 782
Here I want the point area to be proportional to Petal.Width, so I set size as a function of sqrt(Petal.Width).
I'd like the legend to show circles for untransformed values of Petal Width (maybe 1, 2 , 3 and 4 ?)
library(ggplot2)
ggplot() +
geom_point(data= iris, aes(x= Petal.Length, y = Petal.Width, size = sqrt(Petal.Width)))
Upvotes: 0
Views: 27
Reputation: 782
turns out someone always solved this with scale_size_area()
library(ggplot2)
ggplot() +
geom_point(data= iris, aes(x= Petal.Length, y = Petal.Width, size = Petal.Width)) +
scale_size_area()
Upvotes: 1