Closed
Description
bgroup
from base R's plotmath should render big parentheses when saved as a png (or other image filetype). However, it renders as a bunch of boxes stacked on top of each other. This issue only seems to occur on Windows machines which this SO post from December 2022 confirms. It originally seemed that this was resolved as of R4.2.3 but it seems to not be the case.
library(ggplot2)
ggplot(data = mtcars, aes(x = wt, y = mpg)) +
annotate("text", x = 2.5, y = 25,
label = "bgroup('(',atop(x,y),')')",
parse = TRUE) +
annotate("text", x = 3.5, y = 25,
label = "group('(',atop(x,y),')')",
parse = TRUE)
ggsave("test_1.png", plot = last_plot())
I can also reproduce the issue with a base plot with the following code
ragg::agg_png(filename = "test_2.png")
plot(0, xlim = c(0, 1), ylim = c(0, 1))
text(0.5, 0.5, expression(bgroup('(',atop(x,y),')')))
dev.off()
Rendering of bgroup
should look like the following:
grDevices::png(filename = "test_3.png")
plot(0, xlim = c(0, 1), ylim = c(0, 1))
text(0.5, 0.5, expression(bgroup('(',atop(x,y),')')))
dev.off()
Metadata
Metadata
Assignees
Labels
No labels