geom_text_z()
set.seed(1)
N <- 100
plot_df <- data.frame(
x = runif(N),
y = runif(N),
z = runif(N)
)
plot_df$label <- round(plot_df$z, 3)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Create plot with geom_segment_3d()
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p <- ggplot(plot_df, aes(x, y, z=z, label = label)) +
# geom_point_z(z = 0, colour = 'red', size = 5, alpha = 0.5) +
geom_text_z(alpha = 0.1) +
theme_ggrgl() +
labs(
title = "#Numberwang",
subtitle = "ggrgl::geom_text_z()with {devoutrgl}"
) +
theme(legend.position = 'none')
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Render Plot in 3d with {devoutrgl}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
devoutrgl::rgldev(fov = 30, view_angle = -30, zscale = 3)
p
invisible(dev.off())
Use your mouse, mouse buttons and scrollwheel to manipulate the 3d plot