ggplot_donut_percent | R Documentation |
Create a donut plot with the text value of the percentage in the center, using ggplot_donut()
.
ggplot_donut_percent(p, accuracy = NULL, hsize = 4, size = 20, family = "Lato")
p |
Proportion to plot. Must be a value between |
accuracy |
A number to round to. Use (e.g.) Applied to rescaled data. |
hsize |
Size of the donut hole. Defaults to |
size |
Font size to use. Defaults to |
family |
Font family to use. Defaults to |
ggplot_donut_percent()
creates a data frame and calls ggplot_donut()
to create the base plot,
removes the legend, and adds a geom_text()
centered in the plot.
The text label is formatted using scales::label_percent()
with the specified accuracy
.
library(showtext)
font_add_google("Lato", "Lato")
showtext_auto()
# workaround for https://github.com/yixuan/showtext/issues/51
showtext_opts(dpi = 192)
ggplot_donut_percent(0.6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.