View source: R/func_pie_charts.R
build_pie_chart | R Documentation |
Internal function used to build a pie chart using ggplot
build_pie_chart(
df,
location,
cols = NULL,
border = 0.3,
opacity = 1,
border_col = "black"
)
df |
data.frame (see examples). |
location |
string containing the site to subset. |
cols |
vector of colours the same length as the number of clusters. |
border |
numeric value of zero or greater. |
opacity |
numeric value of zero to one. |
border_col |
string denoting colour of pie border. |
A ggplot object.
df <- data.frame(
site = c("London","London","London","Paris","Paris","Paris",
"Berlin","Berlin","Berlin","Rome","Rome","Rome",
"Madrid","Madrid","Madrid"),
cluster = c("Cluster1","Cluster2","Cluster3","Cluster1","Cluster2","Cluster3",
"Cluster1","Cluster2","Cluster3","Cluster1","Cluster2","Cluster3",
"Cluster1","Cluster2","Cluster3"),
value = c(0.95, 0.05, 0, 0.50, 0.45, 0.05, 0.10, 0.45, 0.45, 0,
0.01, 0.99, 0, 0.75, 0.25)
)
build_pie_chart(df, location = "London")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.