ggforce
ggforce copied to clipboard
Fill is lost in facet_zoom when setting alpha
Hi there,
when using a fill for categorical variables and setting an alpha
for it, this fill is lost in a facet_zoom()
. This is not the case when alpha
is not specified.
library(dplyr)
#>
#> Attache Paket: 'dplyr'
#> Die folgenden Objekte sind maskiert von 'package:stats':
#>
#> filter, lag
#> Die folgenden Objekte sind maskiert von 'package:base':
#>
#> intersect, setdiff, setequal, union
library(ggplot2)
library(ggforce)
set.seed(20220201)
# With alpha
tibble(
group = rep(c("a", "b"), each = 10),
score = c(rnorm(10, 5, 2), rnorm(10, 8, 3))
) %>%
ggplot(aes(score, color = group, fill = group)) +
geom_density(alpha = 0.1) +
facet_zoom(xlim = c(6, 8))
# Without alpha
set.seed(20220201)
tibble(
group = rep(c("a", "b"), each = 10),
score = c(rnorm(10, 5, 2), rnorm(10, 8, 3))
) %>%
ggplot(aes(score, color = group, fill = group)) +
geom_density() +
facet_zoom(xlim = c(6, 8))
Created on 2022-02-01 by the reprex package (v2.0.1)
Edit
This was caused by using the wrong graphics device backend in RStudio. Everything's fine with AGG.