Friday, September 18, 2020

Text plot

 ## A blank plot to set up a coordinate system

## Final result will be Figure 3-42
> plot(0:10, 0:10, type = "n")
## Some regular text as a baseline
text(2,10, "Regular text", pos = 4)
## Set text larger and use serif family
par(list(cex = 2, family = "serif"))
## Add some text
text(2,8, "Serif Family", pos = 4)
## Alter rotation and set sans serif family
par(list(srt = 180, family = "sans"))
## Add some text note pos is opposite to previous
text(2,6, "Sans Family", pos = 2)
## Alter rotation and set monospace family
par(list(srt = 90, family = "mono"))
## Add some text
text(8,6, "Monospace Family")
## Reset parameters
par(list(cex = 1, srt = 0, family = ""))
## Create multi-line text
text(2,4, "Multi-line\ntext with\ndefault spacing", pos = 4)
## Alter line height
par(lheight = 2)
## More multi-line text
text(4, 2, "Multi-line\ntext with\ncustom spacing", pos = 4)
## Reset line height
par(lheight = 1)
  



0 comments:

Post a Comment