Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upsize in geom_point using variable with all but 1 as NAs #985
Comments
|
That is a strange one. I'll take a look. Even more minimal reprex: df <- data.frame(x = rep(1:2, each = 2), y = rep(1:2, 2), z = c(1, NA, NA, NA))
ggplot(df, aes(x, y, size = z)) + geom_point() |
|
Ah, this is a bug in function(x, to = c(0, 1), from = range(x, na.rm = TRUE)) {
if (zero_range(from) || zero_range(to)) return(rep(mean(to), length(x)))
(x - from[1]) / diff(from) * diff(to) + to[1]
}If |
|
Fixed by r-lib/scales@b481ee2 |
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