R - Plot Only Text

后端 未结 4 736
予麋鹿
予麋鹿 2021-02-05 04:45

Curious how one might create a plot with only text information. This will essentially be a \"print\" for the plot window.

The best option I\'ve found so far is the foll

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-05 05:04

    You could use annotate in ggplot2 like

    library(ggplot2)
    text = paste("\n   The following is text that'll appear in a plot window.\n",
             "       As you can see, it's in the plot window\n",
             "       One might imagine useful information here")
    ggplot() + 
      annotate("text", x = 4, y = 25, size=8, label = text) + 
      theme_void()
    

    And you can of course remove the plot margins, axes, etc. to have just the text

提交回复
热议问题