In ggplot2 3.1.0, I'm confused about how scale_size_continuous
works. The help documentation seems to suggest that the size scale is controlling point area, with trans="identity"
. Yet it's clear this isn't what's happening.
library(tidyverse)
#make data
plotdat<-data.frame(x=runif(6), y=runif(6), size=seq(10,60,10))
#simple plot
plotdat %>% ggplot(aes(x, y, size=size))+
geom_point()+
scale_size_continuous()
#but help file seems to indicate that scale_size scales point area
?scale_size_continuous
There is a note in the documentation that scale_size_area
ensures that when size==0, the point will have 0 area. If I use this, then it appears that the point area increases linearly with size
.
#simple plot
plotdat %>% ggplot(aes(x, y, size=size))+
geom_point()+
scale_size_area()
What is actually happening with scale_size_continuous
-- how does it translate the size
argument to point area?
EDIT after several comments I have a suspicion: perhaps both scale_size_continuous
and scale_size_area
increase linearly with size, but have different intercepts. Thus the fact that the point associated with size 20 in the first plot is way more than double the area of the point with size 10 is ok, because approximately the same number of pixels are added between 10 and 20 as between 20 and 30 or 40 and 50.
This is not the behavior I would expect when using, e.g. point size to indicate the number of individuals, but is consistent with area increasing linearly with size, within range
.