add_emoji | R Documentation |
Input an emoji and create a ggplot2 layer to add to an existing plot
add_emoji(emoji, x = NULL, y = NULL, ysize = NULL)
emoji |
either a codepoint (without |
x |
x value of the emoji center. Ignored if y and ysize are not specified. |
y |
y value of the emoji center. Ignored if x and ysize are not specified. |
ysize |
Height of the emoji. The width is determined by the aspect ratio of the original image. Ignored if x and y are not specified. |
Use parameters x
, y
, and ysize
to place the emoji at a specified position on the plot. If all three of these parameters are unspecified, then the emoji will be plotted to the full height and width of the plot.
Based on add_phylopic
from rphylopic
by Scott Chamberlain.
## Not run: library(ggplot2) library(emoGG) # Put an emoji anywhere posx <- runif(50, 0, 10) posy <- runif(50, 0, 10) sizey <- runif(50, 0.4, 2) p <- ggplot(data.frame(x = posx, y = posy), aes(x, y)) + geom_point(color = rgb(0,0,0,0)) for (i in 1:50) { p <- p + add_emoji("1f697", posx[i], posy[i], sizey[i]) } p ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.