๐ญ Day 42: Lollipop Chart in Python
๐น What is a Lollipop Chart?
A Lollipop Chart is similar to a bar chart, but:
-
Instead of thick bars → it uses a thin line
-
A dot is placed at the end of the line
It looks cleaner and less heavy than a bar chart.
๐น When Should You Use It?
Use a lollipop chart when:
-
Comparing categories
-
Showing rankings
-
Creating minimal dashboards
-
Replacing traditional bar charts
๐ What We’re Visualizing
Organic Web Traffic Sources:
-
Pinterest → 12
-
Instagram → 18
-
Blog → 29
-
SEO → 34
-
Referrals → 45
This helps us quickly see which channel drives the most traffic.
๐ง๐ป Python Implementation (Plotly)
✅ Step 1: Import Library
import plotly.graph_objects as goWe’re using Plotly Graph Objects for full customization.
✅ Step 2: Define Categories & Values
categories = ['Pinterest', 'Instagram', 'Blog', 'SEO', 'Referrals']✅ Step 3: Create Figure
fig = go.Figure()✅ Step 4: Add the Stem Lines
Each category gets a vertical line from 0 to its value.
✅ Step 5: Add the Circular Markers
This creates the “lollipop head”:
-
Large pastel circles
-
White border
-
Values displayed inside
-
Serif typography for elegance
✅ Step 6: Layout Styling
✨ Styling Highlights:
-
Soft linen background (#FAF9F6)
-
Minimal gridlines
-
Hidden Y-axis
-
Elegant serif typography
-
Balanced spacing
๐ What the Chart Reveals
-
Referrals generate the highest traffic (45)
-
SEO is second strongest (34)
-
Pinterest contributes the least (12)
-
Clear upward trend across channels
Because the chart removes heavy bars, your focus stays on:
✔ Ranking
✔ Comparison
✔ Clean design
๐ก Why Use a Lollipop Chart?
✔ Cleaner than bar charts
✔ Visually modern
✔ Less ink, more clarity
✔ Perfect for aesthetic dashboards
✔ Great for presentations & portfolios
.png)

0 Comments:
Post a Comment