suppressPackageStartupMessages({ library(ggplot2) library(threed) library(ggthreed) }) knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 6 )
library(ggplot2) library(threed) library(ggthreed)
x
variable - which must be discrete.count
geom_threedpie()
overrides the aspect ratio of the plot it is displaying.
This is a gigantic hack! It means it is not possible to use coord_fixed()
etc
to change the plot aspec ratio.theme_void()
. Not sure how to disable
this from within the geom
.ggplot(mtcars) + geom_threedpie(aes(x = as.factor(cyl))) + theme_void() + theme(legend.position = 'bottom')
ggplot(diamonds) + geom_threedpie(aes(as.factor(cut))) + facet_wrap(~clarity, labeller = label_both) + labs(title = "Distribution of Diamond Cuts by Clarity") + scale_fill_brewer(name = "Cut", palette = 'Set2') + theme_void()
threed
library is used to rotate the assembled polygons and perform
perspective projection.ggplot(mtcars) + geom_threedpie(aes(x = as.factor(cyl)), alpha = 0.5) + theme_void() + theme(legend.position = 'bottom')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.