build_pie_chart: Build Pie Chart

View source: R/func_pie_charts.R

build_pie_chartR Documentation

Build Pie Chart

Description

Internal function used to build a pie chart using ggplot

Usage

build_pie_chart(
  df,
  location,
  cols = NULL,
  border = 0.3,
  opacity = 1,
  border_col = "black"
)

Arguments

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.

Value

A ggplot object.

Examples

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")

mapmixture documentation built on April 3, 2025, 7:45 p.m.