This post has been rescued from a side-project blog that I’ve disposed of and slowly reposting content from. In this post I created one of my favourite charts:
This chart was built for the “Pictogram” prompt in the 2022 #30DayChartChallenge. It’s a tired trope to see a normal distribution called something like the “para-normal distribution” with a ghost, I then thought about emoji, 5-sigma and then this idea came about.
To begin I created a dotplot and was lucky enough for my seed to generate a single outlier on the right-side:
In case you’ve not seen it, you can extract all of the coordinates of geoms from a chart via ggplot_build(). Which I’m going to use to add the emoji in place of the dots in the chart:
I then extracted the coordinates of the dots via ggplot_build()
build_gg <-ggplot_build(gg_hist_dot_plot)
Now I use {emo} to create a tibble containing data for my emojis:
library("emo")vec_emojis <-c("3+"= emo::ji("scream"), "3"= emo::ji("fearful"), "2"= emo::ji("confused"), "1"= emo::ji("grin"))data_emoji_positions <- build_gg$data %>%as.data.frame() %>%as_tibble() %>%select(x, xmin, xmax, y, stackpos) %>%mutate(sds_from_mean =case_when( x < ( mean_of_data -3* sd_of_data ) ~"3+", x <= ( mean_of_data -2* sd_of_data ) ~"3", x <= ( mean_of_data -1* sd_of_data ) ~"2", x <= ( mean_of_data +1* sd_of_data ) ~"1", x <= ( mean_of_data +2* sd_of_data ) ~"2", x <= ( mean_of_data +3* sd_of_data ) ~"3", x > ( mean_of_data +3* sd_of_data )~"3+" )) %>%mutate(emoji_symbol = vec_emojis[sds_from_mean])
To visualise the standard deviation components of the Normal distribution I created two utility functions: