Description Usage Arguments Details References Examples
donut
draws a donut chart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
x |
a vector of non-negative numerical quantities. The values in x are displayed as the areas of pie slices. |
labels |
one or more expressions or character strings giving names for the slices. Other objects are coerced by as.graphicsAnnot. For empty or NA (after coercion to character) labels, no label nor pointing line is drawn. |
edges |
the circular outline of the pie is approximated by a polygon with this many edges. |
outer.radius |
the pie is drawn centered in a square box whose sides range from -1 to 1. If the character strings labeling the slices are long it may be necessary to use a smaller radius. |
inner.radius |
radius of donut hole in center |
clockwise |
logical indicating if slices are drawn clockwise or counter clockwise (i.e., mathematically positive direction), the latter is default. |
density |
the density of shading lines, in lines per inch. The default value of NULL means that no shading lines are drawn. Non-positive values of density also inhibit the drawing of shading lines. |
angle |
the slope of shading lines, given as an angle in degrees (counter-clockwise). |
col |
a vector of colors to be used in filling or shading the slices. If missing a set of 6 pastel colours is used, unless density is specified when par("fg") is used. |
border, lty |
(possibly vectors) arguments passed to polygon which draws each slice. |
main |
an overall title for the plot. |
... |
graphical parameters can be given as arguments to donut. They will affect the main title and labels only. |
int.angle |
number specifying the starting angle (in degrees) for the slices. Defaults to 0 (i.e., '3 o'clock') unless clockwise is true where init.angle defaults to 90 (degrees), (i.e., '12 o'clock'). |
Draw a donut chart.
doughnut plot script from https://magesblog.com/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ## Not run:
donut.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)
names(donut.sales) <- c("Blueberry", "Cherry",
"Apple", "Boston Cream", "Other", "Vanilla Cream")
donut(donut.sales) # default colours
donut(donut.sales, col = c("purple", "violetred1", "green3",
"cornsilk", "cyan", "white"))
donut(donut.sales, col = gray(seq(0.4, 1.0, length = 6)))
donut(donut.sales, density = 10, angle = 15 + 10 * 1:6)
donut(donut.sales, clockwise = TRUE, main = "donut(*, clockwise = TRUE)")
segments(0, 0, 0, 1, col = "red", lwd = 2)
text(0, 1, "init.angle = 90", col = "red")
n <- 200
donut(rep(1, n), labels = "", col = rainbow(n), border = NA,
main = "donut(*, labels=\"\", col=rainbow(n), border=NA,..")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.