Create a lollipop chart
lollipopChart(
data,
x,
y,
sort = "none",
bgcol = "white",
xticks = NULL,
yticks = NULL,
xFontSize = 12,
yFontSize = 12,
font = "Verdana, Geneva, Tahoma, sans-serif",
xtitle = NULL,
xtitleFontSize = 14,
ytitle = NULL,
ytitleFontSize = 14,
title = NULL,
titleFontSize = 20,
lineStroke = "maroon",
lineStrokeWidth = 4,
circleFill = "lime",
circleStroke = "lime",
circleStrokeWidth = 1,
circleRadius = 10,
axisCol = "black",
width = NULL,
height = NULL
)
The data frame containing the variables to consider.
The categorical variable to consider. Will be plotted on the x-axis.
The numeric variable to consider. Will be plotted on the y-axis.
Whether to sort or not the vertical lines. Takes three values 'none' which is the default, 'ascending' or 'descending'.
The background-color of the SVG output. Defaults to 'white'.
Optional. the number of x-axis ticks to consider.
Optional. The number of y-axis ticks to consider.
the font size of the x-axis labels. Defaults to 10.
the font size of the y-axis labels. Defaults to 10.
The font family to consider for the titles. Defaults to "Verdana, Geneva, Tahoma, sans-serif".
Optional. The title of the x-axis.
The font size of the x-axis title. Defaults to 16.
Optional. The title of the y-axis.
The font size of the y-axis title. Defaults to 16.
Optional. The title of the plot.
The font size of the plot title. Defaults to 22.
The stroke color of the vertical lines. Defaults to 'maroon'.
The vertical lines stroke's width. Defaults to 4.
The color of the circles. Defaults to 'lime'.
The color of the stroke surrounding the circle. Defaults to 'lime'.
The width of the circles' stroke. Defaults to 1.
The radius of the circles. Defaults to 10.
the color of the x and y axis. It includes the ticks, the labels and titles. Defaults to 'black'.
Optional. The width of the SVG output.
Optional. The height of the SVG output.
A SVG lollipop chart.
library(ggplot2) # needed for the mpg data frame
library(dplyr) # needed for data wrangling
mpg %>% group_by(drv) %>%
summarise(median_cty = median(cty)) %>%
lollipopChart(
x = "drv",
y = "median_cty",
sort = "ascending",
xtitle = "drv variable",
ytitle = "median cty",
title = "Median cty per drv"
)