A lollipop plot is very close from both scatterplot and barplot. Thus, 2 types of input format work to build it. You can have 2 numerical values like for a scatterplot, or one numerical and one categorical variable like for the barplot.

In any case, we will use ggplot2 to realise the figure. There are 2 components for a lollipop plot: the stem which is a segment drawn with geom_segment, and the point that is made using geom_point.

Here are the code for these 2 examples, showing how it works for both data formats. Note that you probably need to custom the appearance of these graphics. A complete section of the gallery is dedicated to lollipop charts.




Make a search



Leave a Reply

Notify of