Description
When I save plots with geom_rect() using either ggsave() or svglite::svglite() the rectangles disappear, but not when I use
grDevices::svg() or png formats.
Code
``` r
library(ggplot2)
library(svglite)
set.seed(123)
df <-
data.frame(
x = rpois(300, 3),
y = c(rbinom(100, 1, .3), rbinom(100, 1, .5), rbinom(100, 1, .7)),
group = factor(rep(c("a", "b", "c"), each = 100))
)
(loghistGraph<-ggplot(df, aes(xmin = x, xmax = x, ymin = rep(0, nrow(df)), ymax = rep(nrow(df)), color = group)) +
geom_rect(size = 4, position = position_dodge(.3))
)

ggsave(plot = loghistGraph, file = "bugGraph.svg")
#> Saving 7 x 5 in image
ggsave(plot= loghistGraph, file = "OkayGraph.png")
#> Saving 7 x 5 in image
# Works
grDevices::svg("DefaultSvgWorks.svg")
print(loghistGraph)
dev.off()
#> png
#> 2
# Doesn't work and save as ggsave
svglite("svgliteBug.svg")
print(loghistGraph)
dev.off()
#> png
#> 2
Created on 2022-12-26 by the reprex package (v2.0.1)
Attached are the graphs that did and did not work.
Using ggsave for .svg

Using svg()

Using ggsave for .png

Using svglite for .svg

Description
When I save plots with
geom_rect()using eitherggsave()orsvglite::svglite()the rectangles disappear, but not when I usegrDevices::svg()or png formats.Code
Created on 2022-12-26 by the reprex package (v2.0.1)
Attached are the graphs that did and did not work.
Using ggsave for .svg

Using svg()

Using ggsave for .png

Using svglite for .svg
