Created
June 2, 2021 17:56
-
-
Save farach/433bb14e1a895900d018c5c81612ef81 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(palmerpenguins) | |
| library(tidyverse) | |
| library(magick) | |
| library(grid) | |
| library(BrailleR) | |
| logo_pp <- image_read("../pp_logo.png") | |
| g <- guide_legend("Species:", override.aes = list(size = 3, alpha = 1)) | |
| cbbPalette <- c("#E69F00", "#0072B2", "#CC79A7") | |
| p <- | |
| penguins %>% | |
| filter_all(~ !is.na(.)) %>% | |
| ggplot(aes(x = bill_length_mm, y = bill_depth_mm, shape = species)) + | |
| geom_point(aes(color = species), alpha = 0.75, size = 2) + | |
| scale_color_manual(values = cbbPalette) + | |
| theme_afs() + # can use theme_minimal() | |
| theme( | |
| legend.position = "bottom", | |
| plot.title = element_text(hjust = 0.5, lineheight = 1.1, | |
| margin = margin(t = 0, r = 10, b = 0, l = 0)), | |
| plot.caption = element_text(hjust = 0.5), | |
| plot.subtitle = element_text(hjust = 0.5), | |
| axis.title.x = element_text(hjust = 1, margin = margin(t = 20, r = 0, b = 10, l = 0)), | |
| axis.title.y = element_text(hjust = 1, margin = margin(t = 0, r = 20, b = 0, l = 0)), | |
| panel.spacing = unit(1, "lines"), | |
| strip.background = element_blank() | |
| ) + | |
| labs( | |
| x = "Bill length (mm)", | |
| y = "Bill depth (mm)", | |
| title = "Palmer Penguins Example Dataset", | |
| subtitle = "This is an example of the BrailleR package", | |
| caption = "Source:\nhttps://allisonhorst.github.io/palmerpenguins/\nhttps://github.com/ajrgodfrey/BrailleR" | |
| ) + | |
| guides(shape = g, color = g, size = g) | |
| p | |
| grid.raster( | |
| logo_pp, | |
| x = 0.05, | |
| y = 0.1, | |
| just = c("left", "bottom"), | |
| width = unit(0.75, "inches") | |
| ) | |
| BrailleR::VI(p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment