library(rgl)
library(devout)
library(devoutrgl)
library(ggrgl)
library(ggplot2)
library(dplyr)
library(CP1919) # Pulsar data used for Joy Division album cover
geom_ribbon_z()
library(CP1919) # Pulsar data used for Joy Division album cover
library(ggplot2)
library(dplyr)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Tweak the pulsar data such that the baseline is always at y = 0
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pulsar_df <- CP1919 %>%
group_by(line) %>%
mutate(
y = y - min(y)
) %>%
ungroup()
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ribbon plot
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p <- ggplot(pulsar_df) +
geom_ribbon_z(aes(x, ymax=y, group=line, z = line), ymin = 0, colour='white') +
theme_void() +
coord_fixed()
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Render Plot in 3d with {devoutrgl}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
devoutrgl::rgldev(fov = 30, view = 'flat', view_flat_angle = 30, zscale = 4)
p
invisible(dev.off())
rgl::rgl.bg(color = 'black')
Use your mouse, mouse buttons and scrollwheel to manipulate the 3d plot