Create a pie chart

pieChart(
data,
value,
label,
colorCategory = "Paired",
labelFont = "sans-serif",
title = NULL,
titleFontSize = 22,
font = "Verdana, Geneva, Tahoma, sans-serif",
bgcol = "white",
opacity = 1,
labelHeight = 18,
width = NULL,
height = NULL
)

## Arguments

data The data frame to consider. The numeric variable to consider. The labeling variable to consider. A D3 categorical color scheme, you can find more here . Defaults to 'Paired' The size of the inner radius of the pie. Defaults to 0. Set the inner radius to a higher value to plot a donut chart. The size of the outer radius of the pie. From the D3 official documentation, The pad radius compute the fixed linear distance separating adjacent arcs, defined as padRadius * padAngle. Optional. From the D3 official documentation, the padAngle is used to set the padding angle between consecutive arcs. From the D3 official documentation, the value of the corner radius for rounded corners. If the corner radius is greater than zero, the corners of the arc are rounded using circles of the given radius. Defaults to 0. The font family of the legend. Defaults to 'sans-serif'. Optional. The title of the plot. The font size of the plot title. Defaults to 22. The font family to consider for the titles. Defaults to "Verdana, Geneva, Tahoma, sans-serif". The background color of the SVG. Defaults to "white". The color opacity of the pie (from 0 to 1). Defaults to 1. The height of the legend. Defaults to 18. Optional. The width of the SVG output. Optional. The height of the SVG output.

A SVG pie chart

## Examples

library(dplyr) # needed for the starwars data frame

# starwars is part of the dplyr data frame
mini_starwars <- starwars %>% tidyr::drop_na(mass) %>%
sample_n(size = 5) # getting 5 random values

pieChart(
data = mini_starwars,
value = "mass",
label = "name"
)