[R] bgroup not rendering properly

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Tue Dec 13 09:38:29 CET 2022


Às 02:13 de 13/12/2022, Derek Ogle escreveu:
> 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
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

Hello,

I can confirm this behavior. ggplot 3.4.0. Works on R 4.2.0 and 4.2.1, 
doesn't work on R 4.2.2.
I left a comment to that SO question.



sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Portugal.utf8 
LC_CTYPE=Portuguese_Portugal.utf8
[3] LC_MONETARY=Portuguese_Portugal.utf8 LC_NUMERIC=C 

[5] LC_TIME=Portuguese_Portugal.utf8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] ggplot2_3.4.0

loaded via a namespace (and not attached):
  [1] fansi_1.0.3      withr_2.5.0      assertthat_0.2.1 dplyr_1.0.10
  [5] utf8_1.2.2       grid_4.2.0       R6_2.5.1         DBI_1.1.3
  [9] lifecycle_1.0.3  gtable_0.3.1     magrittr_2.0.3   scales_1.2.1
[13] pillar_1.8.1     rlang_1.0.6      cli_3.4.1        farver_2.1.1
[17] generics_0.1.3   vctrs_0.5.1      labeling_0.4.2   glue_1.6.2
[21] munsell_0.5.0    compiler_4.2.0   pkgconfig_2.0.3  colorspace_2.0-3
[25] tidyselect_1.2.0 tibble_3.1.8



Hope this helps,

Rui Barradas



More information about the R-help mailing list