[R] bgroup not rendering properly

Jinsong Zhao j@zh@o @end|ng |rom ye@h@net
Tue Dec 13 10:07:00 CET 2022


I don

On 2022/12/13 10:13, Derek Ogle wrote:
> bgroup() from plotmath does not render properly for me. For example
>
> plot(0,xlim=c(0,1),ylim=c(0,1))
> text(0.3,0.5,expression(bgroup('(',atop(x,y),')')))
> text(0.7,0.5,expression(group('(',atop(x,y),')')))
>
> and
>
> library(ggplot2)
> ggplot(mtcars, aes(wt, 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)
>
> both show a proper (though ugly) result from group() (the second text() or
> annotation()) but unrecognizable characters (rather than large parentheses)
> from bgroup().
>
> This problematic result occurred for me when using v4.2.2, but not when
> using 4.2.0, 4.1.2, 4.1.0, or 4.0.5. My sessionInfo is further below.
>
> I did ask this on stackoverflow
> <https://stackoverflow.com/questions/74738827/bgroup-does-not-render-properly-on-ggplot>
> where the resulting figures can be seen.
>
>
> ----
> R version 4.2.2 (2022-10-31 ucrt)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 19044)
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=English_United States.utf8
> [2] LC_CTYPE=English_United States.utf8
> [3] LC_MONETARY=English_United States.utf8
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.utf8
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] compiler_4.2.2 tools_4.2.2
I don't see any problem, especially when outputing the plot to a pdf file.

Best,
Jinsong



More information about the R-help mailing list