I would like to add a multiline text that I have constructed using splitTextGorb
from the package RGraphics
to a base plot. I tried the following but this doesn't work (i.e the text doesn't show on the plot)
layout(matrix(c(1,2), nrow=2, byrow=TRUE), heights = c(1,1.5))
plot(...)
grob = splitTextGrob("This is my text")
plot.new()
vp.BottomRight <- viewport(height=unit(.5, "npc"), width=unit(0.5, "npc"),
just=c("left","top"),
y=0.5, x=0.5)
print(grob, vp = vp.BottonRight)
I know that mtext
is an option to add text to a base plot, but I would like to use splitTextGrob
specifically because it offers some flexibility that mtext
or grid.text()
doesn't.
Any help would be appreciated. Thank you!