I am trying to learn more and more about rayshader
which is a fantastic package.
Based on the code and data below , how can I convert the 2D plots to 3D?
I tried the plot_gg
function, but it does not convert the lines
and histogram
to 3D so, maybe I am missing some steps.
Code + data:
# 3D line plot
df2 = data.frame(supp=rep(c("VC", "OJ"), each=3),
dose=rep(c("D0.5", "D1", "D2"),2),
len=c(6.8, 15, 33, 4.2, 10, 29.5))
gg_line = ggplot(data=df2, aes(x=dose, y=len, group=supp)) +
geom_line()+
geom_point()
# 3D
plot_gg(gg_line, raytrace = TRUE, width = 4,zoom = 0.60, theta = -45, phi = 30,
windowsize = c(1400,866))
df = data.frame(
sex=factor(rep(c("F", "M"), each=200)),
weight=round(c(rnorm(200, mean=55, sd=5), rnorm(200, mean=65, sd=5)))
)
# 3D Histogram with density plot
gg_hist = ggplot(df, aes(x=weight)) +
geom_histogram(aes(y=..density..), colour="black", fill="white")+
geom_density(alpha=.2, fill="#FF6666")
# 3D
plot_gg(gg_hist, raytrace = TRUE, width = 4,zoom = 0.60, theta = -45, phi = 30,
windowsize = c(1400,866))