Description Usage Arguments Author(s) Examples
Function to create donut plot
Run twice to create double layer pie plot
1 2 3 4 5 |
pctr |
# percentage in count [Default = c(.5,.2,.9)] |
legend.label |
legend label |
cols |
colors |
outradius |
outer radius [Default = 1] |
radius |
1-width of the donus [Default =.7] |
add |
Add dounut to the current plot [Default = F] |
innerradius |
innerradius, if innerradius==innerradius then no suggest line [Default= .5] |
legend |
display legend [Default = F] |
pilabels |
display lables for each section of piece [Default = F] |
legend_offset |
non-negative number, legend right position control [Default = .25] |
borderlit |
vector of colors for pie border |
labelcex |
size for lables |
maintitle |
title for the plot |
panle |
counts data |
Copied from internet and modified
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ### Then get the plot is fairly easy:
# INPUT data
browsers <- structure(list(browser = structure(c(3L, 3L, 3L, 3L, 2L, 2L,
2L, 1L, 5L, 5L, 4L),
.Label = c("Chrome", "Firefox", "MSIE","Opera", "Safari"),class = "factor"),
version = structure(c(5L,6L, 7L, 8L, 2L, 3L, 4L, 1L, 10L, 11L, 9L),
.Label = c("Chrome 10.0", "Firefox 3.5", "Firefox 3.6", "Firefox 4.0", "MSIE 6.0",
"MSIE 7.0","MSIE 8.0", "MSIE 9.0", "Opera 11.x", "Safari 4.0", "Safari 5.0"),
class = "factor"),
share = c(10.85, 7.35, 33.06, 2.81, 1.58,13.12, 5.43, 9.91, 1.42, 4.55, 1.65),
ymax = c(10.85, 18.2, 51.26,54.07, 55.65, 68.77, 74.2, 84.11, 85.53, 90.08, 91.73),
ymin = c(0,10.85, 18.2, 51.26, 54.07, 55.65, 68.77, 74.2, 84.11, 85.53,90.08)),
.Names = c("browser", "version", "share", "ymax", "ymin"),
row.names = c(NA, -11L), class = "data.frame")
## data clean
browsers=browsers[order(browsers$browser,browsers$share),]
arr=aggregate(share~browser,browsers,sum)
### choose your cols
mainCol=c("Blue","Green","Purple","Red","Grey")
donuts_plot(browsers$share,rep(1,11),browsers$version,
cols=subcolors(browsers,"browser",mainCol),
legend=F,pilabels = T,borderlit = rep(F,4) )
donuts_plot(arr$share,rep(1,5),arr$browser,
cols=mainCol,pilabels=F,legend=T,legend_offset=-.02,
outradius = .71,radius = .0,innerradius=.0,add=T,
borderlit = rep(F,4) )
###end of line
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.