Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
differing behaviour using "color = NA" in Linux and Windows #3129
During a project, I used following snippet to draw a completely transparent hexbin map:
plot <- ggplot(data, aes(x = lon, y = lat, z = marks)) + coord_fixed(ratio = width/height) + stat_summary_hex(binwidth = c(width * scale, height * scale), color = NA, show.legend = FALSE, size = border_width) scale_fill_gradient(low = "#00000000", high = "#00000000") + theme_void()
Note the color argument in
Explicitly specifying the plot to be transparent via
The point still stands, that
Could you please turn this into a self-contained reprex (short for minimal reproducible example)? It will help us help you if we can be sure we're all working with/looking at the same stuff.
If you've never heard of a reprex before, you might want to start by reading the tidyverse.org help page.
You can install reprex by running (you may already have it, though, if you have the tidyverse package installed):
Gradients with transparency were only recently introduced in the scales package. My hunch is that the scales package on the windows system is too old. Could you check which version you have there? Start a new R session, and then enter:
Then post the output here.
library(ggplot2) data <- data.frame(lon = c(1, 2, 3), lat = c(1, 2, 3), marks = c(0, 1, 0)) myplot <- ggplot(data, aes(x = lon, y = lat, z = marks)) + stat_summary_hex(color = NA, show.legend = FALSE) + scale_fill_gradient(low = "#00000000", high = "#00000000") + theme_void() myplot
Created on 2019-02-11 by the reprex package (v0.2.1)
Indeed, scales is at 1.0.0 on the Linux machine and 0.5.0 on the Windows box. I only checked ggplot2 and hexbin versions before. Thanks for the hint!