1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
library(datapasta)
library(esquisse)
library(ggplot2)
ggplot(data) + aes(x = carat, y = price) + geom_point(size = 1L, colour = "#26828e") + geom_smooth(span = 0.75) + labs(x = "carat", y = "price", title = "heres my title", subtitle = "a view of diamonds", caption = "hello caption") + theme_minimal()
data %>% filter(depth >= 60L & depth <= 79L) %>% ggplot() + aes(x = carat, y = price) + geom_point(size = 0.78, colour = "#000000") + labs(x = "carat", y = "price", title = "heres my title", subtitle = "a view of diamonds", caption = "hello caption") + theme_minimal()
data %>% filter(depth >= 60L & depth <= 79L) %>% ggplot() + aes(x = carat, y = price) + geom_point(size = 0.78, colour = "#000000") + labs(x = "carat", y = "price", title = "heres my title", subtitle = "a view of diamonds", caption = "hello caption") + theme_minimal()
library(rayshader)
loadzip = tempfile() download.file("https://tylermw.com/data/dem_01.tif.zip", loadzip) localtif = raster::raster(unzip(loadzip, "dem_01.tif")) unlink(loadzip)
elmat = raster_to_matrix(localtif)
elmat %>% sphere_shade(texture = "desert") %>% plot_map()
a = data.frame(x = rnorm(20000, 10, 1.9), y = rnorm(20000, 10, 1.2)) b = data.frame(x = rnorm(20000, 14.5, 1.9), y = rnorm(20000, 14.5, 1.9)) c = data.frame(x = rnorm(20000, 9.5, 1.9), y = rnorm(20000, 15.5, 1.9)) data = rbind(a, b, c)
pp = ggplot(data, aes(x = x, y = y)) + geom_hex(bins = 20, size = 0.5, color = "black") + scale_fill_viridis_c(option = "C")
par(mfrow = c(1, 2)) plot_gg(pp, width = 5, height = 4, scale = 300, raytrace = FALSE, preview = TRUE) plot_gg(pp, width = 5, height = 4, scale = 300, multicore = TRUE, windowsize = c(1000, 800)) render_camera(fov = 70, zoom = 0.5, theta = 130, phi = 35) Sys.sleep(0.2) render_snapshot(clear = TRUE)
par(mfrow = c(1, 1)) plot_gg(pp, width = 5, height = 4, scale = 300, raytrace = FALSE, windowsize = c(1200, 960), fov = 70, zoom = 0.4, theta = 330, phi = 20, max_error = 0.01, verbose = TRUE)
|