Description Usage Arguments Value Examples
Utility to make a ggplot pie chart
1 2 3 |
type |
- a character vector of pie segments names |
percent |
- a numeric vector of pie segments values (make them add to 100) |
type.title.str |
= 'Title String Here' - a title for the plot |
segment.name |
= 'Type' - the legend title |
segment.cols |
= NULL - used to control colours of the segments |
segment.breaks |
= NULL - used to control colours of the segments |
label.size |
= 4 - used to adjust percent text label size |
a ggplot object with your pie chart
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
# Get these two vectors in the order you need and make sure
# the percent add up to 100
type<-c('Comp1','Comp2','Comp3','Other')
percent<-c(65,20,10,5)
#Set up the pie chart characteristics
pie.trace.cols<-c('Comp1'='cornflowerblue','Comp2'='forestgreen','Comp3'='orange','Other'='indianred2')
pie.breaks<-c('Comp1','Comp2','Comp3','Other')
pie.segment.name<-'Variation Type'
type.title.str<-'Three Variation Components'
p<-MakePie(type,percent,type.title.str
,segment.name=pie.segment.name
,segment.cols=pie.trace.cols
,segment.breaks=pie.breaks)
print(p)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.