Created
August 2, 2021 11:33
-
-
Save k-hench/2bf220638c5db803d5db4c20f8e10b51 to your computer and use it in GitHub Desktop.
This file contains 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(tidyverse) | |
library(patchwork) | |
pal <- 1 | |
walk_df <- tibble(x = seq(from = 0, to = 200, length.out = 15), | |
y = seq(from = 200, to = 0, length.out = 15)) %>% | |
mutate(val = map2_dbl(x,y, mirror_ratio)) | |
library(patchwork) | |
(walk_df %>% | |
ggplot(aes(x = x, y = val, color = val)) + | |
geom_path() + | |
geom_point(shape = 21, fill = "white", size = 2)+ | |
scale_color_distiller(type = "div", palette = pal, | |
limits = c(-1, 1), | |
guide = "none") ) + | |
(cross_df(.l = list(x = 0:200, | |
y = 0:200)) %>% | |
mutate(val = map2_dbl(x,y, mirror_ratio)) %>% | |
ggplot(aes(x,y,fill = val)) + | |
geom_raster(alpha = .65) + | |
geom_contour(aes(z = val, color = ..level..)) + | |
geom_path(data = walk_df, aes(color = val)) + | |
geom_point(data = walk_df, aes(color = val), shape = 21, fill = "white", size = 4) + | |
coord_equal(expand = 0) + | |
scale_fill_distiller(type = "div", palette = pal, limits = c(-1, 1), | |
guide = guide_colorbar(title.position = "top", | |
barwidth = unit(.9, "npc"), | |
barheight = unit(5, "pt"))) + | |
scale_color_distiller(type = "div", palette = pal, limits = c(-1, 1), | |
guide = "none"))+ | |
plot_layout(heights = c(.3,1), ncol = 1) & | |
theme_minimal() & | |
theme(legend.position = "bottom") | |
ggsave("~/Desktop/mirror_ratio.pdf", width = 6, height = 9, device = cairo_pdf, bg = "transparent") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment