1

How can one change the text font in a transition diagram created with the GMisc package in R?

I can get 2% of the way there as follows:

library(grid)
library(Gmisc)

grid.newpage()
txt <-
  "Just a plain box"

windowsFonts(
  A=windowsFont("TT Courier New"),
  B=windowsFont("TT Helvetica"),
  C=windowsFont("TT Montserrat")
)
boxGrob(txt, txt_gp = getOption("boxGrobTxt", default = gpar(fontfamily = "A")))
boxGrob(txt, txt_gp = getOption("boxGrobTxt", default = gpar(fontfamily = "B")))
boxGrob(txt, txt_gp = getOption("boxGrobTxt", default = gpar(fontfamily = "C")))

which generates the single box in the three different fonts successively.

I'm looking for a way to achieve the same thing globally when rendering a transition plot created as in the vignette, i.e.,

library(Gmisc)
transitions <- table(data$Charnley_class, data$Charnley_class_1yr) %>%
  getRefClass("Transition")$new(label=c("Before surgery", "1 year after"))
transitions$render()
David Kaufman
  • 989
  • 1
  • 7
  • 20

0 Answers0