Skip to content

Instantly share code, notes, and snippets.

@wjakethompson
Created September 4, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wjakethompson/d0d645e142680546372eb83240e3ad1c to your computer and use it in GitHub Desktop.
Save wjakethompson/d0d645e142680546372eb83240e3ad1c to your computer and use it in GitHub Desktop.
# inspired by https://twitter.com/mbostock/status/1036391604100055040
library(tidyverse)
plot_data <- crossing(x = seq(-20, 20, 0.01), y = seq(-20, 20, 0.01)) %>%
mutate(
depth = sin(sin(x * (sin(y) - cos(x)))) - cos(cos(y * (cos(x) - sin(y))))
)
ggplot(plot_data, aes(x = x, y = y)) +
geom_raster(aes(fill = depth), interpolate = TRUE) +
scale_fill_viridis_c(option = "C") +
theme_void() +
coord_equal() +
theme(legend.position = "none")
@wjakethompson
Copy link
Author

contour_plot

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