plot_lollipop: Plot lollipop

View source: R/graphics.R

plot_lollipopR Documentation

Plot lollipop

Description

This function creates a lollipop chart using ggplot2.

Usage

plot_lollipop(
  data,
  label_x = "",
  label_y = "",
  colors = NULL,
  color_text = "black",
  size_text = 3,
  size_ball = 8,
  alpha_ball = 0.2,
  min_value = 0,
  max_value_gap = 1
)

Arguments

data

data.frame contain x, value, and variable

label_x

x-axis label

label_y

y-axis label

colors

color vector

color_text

color of text inside ball

size_text

size of text inside ball

size_ball

size of ball

alpha_ball

transparency of ball

min_value

minimum value

max_value_gap

maximum value gap

Value

returns a ggplot graphic

Examples

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

#ploting data
grf <- plot_lollipop(data, colors="blue", max_value_gap=0.2)
plot(grf)

daltoolbox documentation built on Nov. 3, 2024, 9:06 a.m.