3.7 Lollipop Chart
A lollipop plot is a hybrid between a scatter plot and a barplot. It shows the relationship between a numerical variable and another variable, numerical or categorical. It's better to decrease the order and represent horizontal lines.

First, Let's create a dataset.
# Create a dataset
df = pd.DataFrame({'group':list(map(chr, range(70, 90))), 'values':np.random.uniform(size=20)})
ordered_df = df.sort_values(by='values') # reorder it by 'values'
my_range=range(1,len(df.index)+1) # calcaulate data range1. Univariate Lollipop

2. Highlight Lollipop
Moreover, we .can add some eye-catching features for storytelling. For example, highlight a group that specifically interests you with a bigger size and different colors.

3. Multivariate Lollipop
We can use multi-variables lollipop if you have more than one observation for each group. Instead of displaying the values of both groups one beside each other, show them on the same line, and represent the difference.
Now we need to create a new dataset with two variables.

Last updated
Was this helpful?