geom_donut_slice {ggtricks} | R Documentation |
Create donut slice plot using Cartesian coordinates system
Description
There are two arguments absolutely needed in aes()
mappings:
-
cat
A discrete categories vector. -
val
A numerical values vector.
Usage
geom_donut_slice(
mapping = NULL,
data = NULL,
show.legend = NA,
na.rm = FALSE,
inherit.aes = TRUE,
slice_angle = 180,
init_angle = 0,
x0 = 0,
y0 = 0,
r1 = 1,
r2 = 0.65,
color = "black",
alpha = 1,
linewidth = 0.5,
slice_position = NA,
labels_with_tick = FALSE,
link_with_origin = FALSE,
labels_family = "",
labels_size = 5,
labels_col = "black",
labels_hjust = 0.5,
labels_vjust = 0.5,
labels_fontface = "plain",
labels_lineheight = 1.2,
tick_lwd = 1,
...
)
Arguments
mapping |
Set of aesthetic mappings created by |
data |
to be displayed in this layer |
show.legend |
logical. Should this layer be included in the legends?
|
na.rm |
If |
inherit.aes |
If |
slice_angle |
Pie slice angle |
init_angle |
Starting angle |
x0 |
Init position x |
y0 |
Init position y |
r1 |
Outer circle radius |
r2 |
Inner circle radius, should inferior to |
color |
Plot border colour |
alpha |
Filling colour transparency [0,1] |
linewidth |
Plot border size |
slice_position |
Pie slice position |
labels_with_tick |
|
link_with_origin |
|
labels_family |
Labels font family |
labels_size |
Labels font size |
labels_col |
Labels colour |
labels_hjust |
Labels horizontal adjusting |
labels_vjust |
Labels vertical adjusting |
labels_fontface |
Labels font face |
labels_lineheight |
Labels line height |
tick_lwd |
Ticks Size |
... |
other arguments passed on to |
Value
A ggplot2 layer.
Examples
my_df <- data.frame(cat = c("Apple", "Banana", "Pineapple"), val = c(2.65, 4.5, 6.25))
my_df |>
ggplot2::ggplot() +
geom_donut_slice(ggplot2::aes(cat = cat, val = val)) +
ggplot2::coord_equal()