Created
February 15, 2022 14:42
-
-
Save ctesta01/a5dc011dcd3b97437f162f7184d37e3e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggforce) | |
| tw <- -2:1 + .5 # triangle width points | |
| th <- 0:3 + .5 # triangle height points | |
| triangle <- rbind(c(-2,0), c(2,0), c(0,4)) | |
| nudge_factor <- 0.15 | |
| df <- tibble::tribble( | |
| ~x, ~y, ~label, | |
| tw[1]+nudge_factor, th[1], "cleaning\nhygeine", | |
| tw[2], th[1], "fun\nexercise\nstretching", | |
| tw[3], th[1], "nutrition\nhydration", | |
| tw[4]-nudge_factor, th[1], "rest\nrelaxation", | |
| mean(tw[c(1,2)])+nudge_factor, th[2], "intellectual\nstimulation", | |
| mean(tw[c(2,3)]), th[2], "reflection\nmeditation", | |
| mean(tw[c(3,4)])-nudge_factor, th[2], "socialization", | |
| mean(tw[c(1:3)])+nudge_factor/1.5, th[3], "artful\nexpression", | |
| mean(tw[c(2:4)])-nudge_factor/1.5, th[3], "financial\nmanagement", | |
| 0, th[4]-nudge_factor, "purpose\nmoral\nvirtue" | |
| ) | |
| ggplot(df, aes(x = x, y = y, label = label, group = -1L)) + | |
| geom_voronoi_tile(aes(fill = label), color = 'black', bound = triangle, alpha=0.7) + | |
| geom_text(size = 3) + | |
| labs(title = "A re-envisioning of Maslow's hierarchy of needs") + | |
| theme_void() + | |
| scale_color_manual(values = c(`b` = 'black', `a` = 'white')) + | |
| scale_fill_viridis_d(option = 'inferno', begin = 0.2) + | |
| theme(plot.title = element_text(size = 14, vjust = 1, hjust = 0.5)) + # Center ggplot title | |
| theme(legend.position = 'none') | |
| ggsave("riff_on_maslow.png", width = 6, height = 5) | |
| ggsave("riff_on_maslow.jpg", width = 6, height = 5) |
ctesta01
commented
Feb 15, 2022
Author

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment