This odd problem may be restricted to Windows. I've been trying to produce a plot with a shaded region using the annotate geom. If I set the alpha for the fill to less than 0.6, then when opening in the default image viewer for Windows the shaded area appears briefly and then disappears. The rest of the plot is still displayed and the plot displays without a problem in the viewer panel.
I've narrowed this down to a problem with cowplot by running the code below and this displays normally. I've added my session info below the reprex.
Brief description of the problem or desired feature.
``` r
library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.0.5
# library(cowplot)
library(viridis)
#> Warning: package 'viridis' was built under R version 4.0.5
#> Loading required package: viridisLite
#> Warning: package 'viridisLite' was built under R version 4.0.5
library(lubridate)
#> Warning: package 'lubridate' was built under R version 4.0.5
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
data("mtcars")
dat <- data.frame(expand.grid(seq.Date(today() - 365, to = today(), by = 1), c("a", "b", "c")))
names(dat) <- c("date", "grp")
dat$val <- runif(n = 1098)
p <- ggplot(data = dat, aes(x = date, y = val, group = grp)) +
facet_wrap(.~grp, ncol = 1) +
annotate("rect", xmin = today() - 28, xmax = today(), ymin = min(dat$val),
ymax = max(dat$val), alpha = .1, fill = "blue") +
scale_fill_viridis_d("val", option = "D", begin = 0.5,
end = 0.1) +
# theme_cowplot() +
geom_col(aes(fill = grp))
p
This odd problem may be restricted to Windows. I've been trying to produce a plot with a shaded region using the annotate geom. If I set the alpha for the fill to less than 0.6, then when opening in the default image viewer for Windows the shaded area appears briefly and then disappears. The rest of the plot is still displayed and the plot displays without a problem in the viewer panel.
I've narrowed this down to a problem with cowplot by running the code below and this displays normally. I've added my session info below the reprex.
Brief description of the problem or desired feature.
Created on 2022-01-13 by the reprex package (v2.0.1)