| sm_add_text | R Documentation | 
Add a text annotation onto the combined plot
sm_add_text(
  label,
  x = 0.5,
  y = 0.5,
  angle = 0,
  color = "black",
  fontface = "plain",
  size = 10,
  ...
)
| label | Text label in strings. | 
| x | Location of the text annotation along the x-axis of the combined figure. Default is the middle origin (0.5). Values from 0 to 1. | 
| y | Location of the text annotation along the y-axis of the combined figure. Default is the middle origin (0.5). Values from 0 to 1. | 
| angle | Angle of the text. Default is set to 0 (i.e., horizontal orientation). | 
| color | Color of the text. Default is set to 'black'. | 
| fontface | The default is to set the text as plain This can be changed, to either "plain", "bold", "italic", "bold.italic" . | 
| size | Size of the text annotation | 
| ... | Other parameters of the text that will be transferred to the function annotate() from ggplot2. | 
Prints a text in the combined plot.
library(smplot2)
library(ggplot2)
ggplot(data = mtcars, mapping = aes(x = drat, y = mpg)) +
 geom_point(shape = 21, fill = '#0f993d', color = 'white',
            size = 3) -> p1
ggplot(data = mtcars, mapping = aes(x = drat, y = mpg)) +
 geom_point(shape = 21, fill = '#0f993d', color = 'white', size = 3) +
 sm_hvgrid() -> p2
combined_fig <- sm_put_together(list(p1,p2), ncol=2,nrow=1)
combined_fig + sm_add_text(label='My label', x = .5, y= .5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.