Section 6.2 of A Layered Grammar of Graphics says the following:
In the grammar, a pie chart is a stacked bar geom drawn in a polar coordinate system.
Similarly, the documentation for ggplot2's coord_polar says:
#' # A pie chart = stacked bar chart + polar coordinates pie <- ggplot(mtcars, aes(x = factor(1), fill = factor(cyl))) + geom_bar(width = 1) pie + coord_polar(theta = "y")
Running only the first line of their code, I get the following graph.

The documentation for spineplot (base R, not ggplot), says:
Spine plots are a special cases of mosaic plots, and can be seen as a generalization of stacked (or highlighted) bar plots.
After reading this, I thought that I would be able to get spineplot to generate a graph like the stacked bar chart above. However, I have failed in every attempt. For various reasons, all of the following throw errors:
spineplot(table(mtcars$cyl))
spineplot(prop.table(mtcars$cyl))
spineplot(factor(mtcars$cyl))
spineplot(mtcars$cyl,nrow(mtcars))
spineplot(factor(mtcars$cyl),nrow(mtcars))
spineplot(nrow(mtcars),factor(mtcars$cyl))
This is much unlike base R's pie(table(mtcars$cyl)) and mosaicplot(table(mtcars$cyl)) which both work without complaint, but do not show the counts for each variable.
So, is it possible to get spineplot to generate the desired stacked bar chart? Or do I have some misunderstanding over what a spineplot is? The article linked earlier also claims that "A bullseye chart is the polar equivalent of the spineplot" and that a pie chart is just a transformed bullseye plot, so there definitely should be some very strong relationship between spineplots and stacked bar charts.


