The following code produces a chart with emojis instead of point shapes.
library(tidyverse)
library(emojifont)
load.emojifont("OpenSansEmoji.ttf")
pal <- c("\U1f337"="blue","\U1f370"="red")
set.seed(124)
xdf <- data_frame(x=rnorm(10),y=rnorm(10),
label=rep(c("\U1f337","\U1f370"),5))
xdf %>% ggplot(aes(x=x,y=y,label=label,color=factor(label))) +
geom_text(family="OpenSansEmoji") +
scale_color_manual("object",values=pal) +
guides(color=guide_legend(labels=FALSE)) +
theme(legend.text=element_text(family="OpenSansEmoji"))
It is easy to see that the legend as informative as it could be.
It would be nice to have colored emojis instead of twice the colored letter a
, and instead of the black emojis, I would like to have the words tulip
and cake
.
Can this be accomplished?