Draw interactive pie charts using plotly
.
Usage
draw_pie(
x,
main = NULL,
xlab = NULL,
ylab = NULL,
col = NULL,
alpha = 0.8,
bg = NULL,
plot_bg = NULL,
theme = getOption("rtemis_theme", "black"),
palette = rtemis_palette,
category_names = NULL,
textinfo = "label+percent",
font_size = 16,
labs_col = NULL,
legend = TRUE,
legend_col = NULL,
sep_col = NULL,
margin = list(b = 50, l = 50, t = 50, r = 20),
padding = 0,
displayModeBar = TRUE,
modeBar_file_format = "svg",
filename = NULL,
file_width = 500,
file_height = 500,
file_scale = 1,
...
)
Arguments
- x
data.frame: Input: Either a) 1 numeric column with categories defined by rownames, or b) two columns, the first is category names, the second numeric or c) a numeric vector with categories defined using the
category.names
argument.- main
Character: Plot title. Default = NULL, which results in
colnames(x)[1]
.- xlab
Character: x-axis label.
- ylab
Character: y-axis label.
- col
Character: Colors for the pie slices.
- alpha
Numeric: Alpha for the pie slices.
- bg
Character: Background color.
- plot_bg
Character: Plot background color.
- theme
Character: "light", "dark". Default =
getOption("rtemis_theme", "light")
.- palette
Character: Color palette to use.
- category_names
Character, vector, length = NROW(x): Category names. Default = NULL, which uses either
rownames(x)
, or the first column ofx
ifncol(x) = 2
.- textinfo
Character: Info to show over each slice: "label", "percent", "label+percent".
- font_size
Integer: Font size for labels.
- labs_col
Character: Color of labels.
- legend
Logical: If TRUE, show legend.
- legend_col
Character: Color for legend.
- sep_col
Character: Separator color.
- margin
List: Margin settings.
- padding
Numeric: Padding between cells.
- displayModeBar
Logical: If TRUE, display the plotly mode bar.
- modeBar_file_format
Character: File format for image exports from the mode bar.
- filename
Character: File name to save plot.
- file_width
Integer: Width for saved file.
- file_height
Integer: Height for saved file.
- file_scale
Numeric: Scale for saved file.
- ...
Additional arguments to pass to the theme function.