When passing a variable in the data.frame to the size argument in geom_point, if the column to be all but one as NA, all values get plotted equally, i.e. NAs are not dropped. If two non-NA values exist, the plot looks as expected.
Wanted to know if it is an unavoidable consequence of how size is calculated, or really a bug. It the later I could try finding/fixing it.
df <- data.frame(year=rep(10:14, each=3), age=1:3, data=runif(15))
# points sized as expected
ggplot(df, aes(year, age)) + geom_point(aes(size=data))
# convert all values but 2 into NAs
df$data[1:13] <- NA
#2 points sized and shown
ggplot(df, aes(year, age)) + geom_point(aes(size=data), na.rm=TRUE)
# convert all but one value into NA
df$data[1:14] <- NA
# plot shows equal-sized dots for all datapoints
ggplot(df, aes(year, age)) + geom_point(aes(size=data), na.rm=TRUE)
I tried with different names for the data column, but it made no difference. Tested in both ggplot2 1.0.0 from CRAN and 1.0.0.99 from github.
Thanks
When passing a variable in the data.frame to the size argument in geom_point, if the column to be all but one as NA, all values get plotted equally, i.e. NAs are not dropped. If two non-NA values exist, the plot looks as expected.
Wanted to know if it is an unavoidable consequence of how size is calculated, or really a bug. It the later I could try finding/fixing it.
I tried with different names for the data column, but it made no difference. Tested in both ggplot2 1.0.0 from CRAN and 1.0.0.99 from github.
Thanks