How to do a scatter plot with empty circles in Python?
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.
Introduction
Hollow circle markers are useful when a scatter plot is dense and filled markers would hide overlap. In Matplotlib, the core trick is to draw markers with no face color and a visible edge color, then tune size, line width, and transparency for the actual data density.
Create Hollow Markers with plt.scatter
The standard pattern is facecolors="none" together with an explicit edge color.
This is usually enough for a clean exploratory plot.
Tune Marker Size and Transparency for Dense Data
A style that works for 100 points may fail badly for 10,000. For dense plots, reduce marker size and add alpha so outlines do not become a solid blob.
The goal is not just hollow markers. The goal is readable density.
Plot Multiple Groups with Different Edge Colors
If categories matter, draw each group separately and use color only on the outline. That keeps the chart lighter while preserving group identity.
This pattern is common in scientific figures where filled shapes would make overlapping classes hard to inspect.
Work from a Pandas DataFrame
If your data already lives in pandas, pass the columns directly to Matplotlib.
The marker settings stay the same. Only the data source changes.
Export with Enough Resolution
Thin outlines can disappear in slides or documents if the exported image uses low DPI. Save with higher resolution and test the final output size.
If the plot will appear on a dark background, verify that your edge color still has enough contrast.
Add a Regression Line Without Losing Marker Clarity
If you need a trend line, draw it separately and keep the markers hollow. That preserves the visual benefit of empty circles while still communicating direction.
Common Pitfalls
- Forgetting
facecolors="none", which produces normal filled markers instead of empty circles. - Using outlines that are too thin to survive export or presentation scaling.
- Keeping marker sizes too large for dense data, which creates heavy visual clutter.
- Encoding multiple categories with nearly identical edge colors.
- Assuming one marker style works for both exploratory plots and publication-quality figures.
Summary
- Use
plt.scatterwithfacecolors="none"to create hollow circles. - Set
edgecolorsandlinewidthsexplicitly so the markers remain visible. - Reduce size and add transparency when plotting dense data.
- Plot categories separately when color encodes class membership.
- Export at higher DPI if thin outlines need to remain sharp.
Related reading
- How to do exponential and logarithmic curve fitting in Python? I found only polynomial fitting
- How to do multi class classification using Support Vector Machines SVM
- How to do recursive feature elimination with SVM in R
- How to download graphs from tensorboard?
- how to do async task in django?
- How to do gaussian/polynomial regression with scikit-learn?
- How to draw vertical lines on a given plot
- How to drop a list of rows from Pandas dataframe?
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
ML System Design practice on Codemia
Design recommenders, ranking systems and training pipelines the way ML interviews actually ask for them, with worked solutions.