rayshader
包可以将ggplot2
图片转换为3D.
参考原作者帖子:
https://www.tylermw.com/3d-ggplots-with-rayshader/
1 安装
devtools::install_github("tylermorganwall/rayshader")
2 使用
library(rayshader)
library(ggplot2)
library(tidyverse)
gg <- ggplot(diamonds, aes(x, depth)) +
stat_density_2d(aes(fill = stat(nlevel)),
geom = "polygon",
n = 100,bins = 10,contour = TRUE) +
facet_wrap(clarity~.) +
scale_fill_viridis_c(option = "A")
rayshader::plot_gg(gg, multicore = TRUE, width = 5, height = 5,scale = 250)
blogdown::shortcode("video", src = "./test.mp4")
blogdown::shortcode("youtube", "p4liifrbK8w")