pie_chart | R Documentation |
This function generates a pie chart or a donut chart from the input data. It allows customization of various visual aspects such as colors, labels, and title.
pie_chart(
input,
var,
var2 = NULL,
type = 2,
show_freq = FALSE,
color = NULL,
palette = "jama",
title = NULL,
text_size = 10,
title_size = 20,
add_sum = FALSE
)
input |
The input dataframe. |
var |
The variable on which the pie chart or donut chart will be based. |
var2 |
Optional. A secondary variable for creating a donut chart. Default is NULL. |
type |
The type of chart to be generated. 1 for pie chart, 2 for donut chart, 3 for donut chart based on webr package. |
show_freq |
Boolean indicating whether to show frequencies on the chart. Default is FALSE. |
color |
Optional. The color palette for the chart. If not provided, a default color palette will be used. |
palette |
Optional. The color palette to be used if color is not specified. Default is "jama". |
title |
Optional. The title of the chart. Default is NULL. |
text_size |
The size of the text on the chart. Default is 10. |
title_size |
The size of the title text on the chart. Default is 20. |
add_sum |
Boolean indicating whether to add the sum of frequencies to the chart. Default is FALSE. |
Dongqiang Zeng
pie_chart(input = sig_stad, var = "Subtype", palette = "jama")
pie_chart(input = sig_stad, var = "Subtype", palette = "nrc")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.