Learn R Programming

daltoolbox (version 1.1.727)

plot_pieplot: Plot pie

Description

This function creates a pie chart using ggplot2.

Usage

plot_pieplot(
  data,
  label_x = "",
  label_y = "",
  colors = NULL,
  textcolor = "white",
  bordercolor = "black"
)

Value

returns a ggplot graphic

Arguments

data

data.frame contain x, value, and variable

label_x

x-axis label

label_y

y-axis label

colors

color vector

textcolor

text color

bordercolor

border color

Examples

Run this code
#summarizing iris dataset
data <- iris |> dplyr::group_by(Species) |>
 dplyr::summarize(Sepal.Length=mean(Sepal.Length))
head(data)

#ploting data
grf <- plot_pieplot(data, colors=c("red", "green", "blue"))
plot(grf)

Run the code above in your browser using DataLab