The same plot in 14 other libraries — Python: Altair, Bokeh, lets-plot, Matplotlib, Plotly, Pygal, Seaborn; R: ggplot2; Julia: Makie.jl; JavaScript: Chart.js, D3.js, Apache ECharts, Highcharts, MUI X Charts. Compare all 15 side by side: Dot Matrix Chart for Proportional Counts in Python, R, Julia and JavaScript.
A dot matrix chart displays proportions using a grid of equally-sized dots where filled or colored dots represent counts out of a total. Each dot corresponds to one unit, making it intuitive to read "X out of N" statistics at a glance. Unlike waffle charts that use percentage-based squares, dot matrix charts emphasize absolute counts with variable grid sizes, excelling at risk communication and survey result visualization.

""" anyplot.ai
dot-matrix-proportional: Dot Matrix Chart for Proportional Counts
Library: plotnine 0.15.4 | Python 3.13.13
Quality: 88/100 | Created: 2026-05-08
"""
import os
import sys
# Prevent this file from shadowing the installed plotnine package
sys.path = [p for p in sys.path if p != os.path.dirname(os.path.abspath(__file__)) and p != ""]
import pandas as pd
from plotnine import (
aes,
coord_fixed,
element_rect,
element_text,
geom_point,
ggplot,
ggsave,
labs,
scale_color_manual,
theme,
theme_void,
)
# Theme tokens
THEME = os.getenv("ANYPLOT_THEME", "light")
PAGE_BG = "#FAF8F1" if THEME == "light" else "#1A1A17"
ELEVATED_BG = "#FFFDF6" if THEME == "light" else "#242420"
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
IMPRINT = ["#009E73", "#C475FD", "#4467A3"]
# Data – Household Solar Panel Adoption Survey (100 homes, 10×10 grid)
categories = ["Fully Solar-Powered", "Partially Solar-Powered", "No Solar Panels"]
counts = [24, 41, 35]
total = sum(counts) # 100
cols = 10
labels = []
for cat, cnt in zip(categories, counts, strict=True):
labels.extend([cat] * cnt)
df = pd.DataFrame(
{
"x": [i % cols for i in range(total)],
"y": [-(i // cols) for i in range(total)],
"category": pd.Categorical(labels, categories=categories),
}
)
# Legend labels include counts
legend_labels = [f"{cat} ({cnt})" for cat, cnt in zip(categories, counts, strict=True)]
# Plot
plot = (
ggplot(df, aes(x="x", y="y", color="category"))
+ geom_point(size=9)
+ scale_color_manual(values=IMPRINT, labels=legend_labels)
+ coord_fixed()
+ labs(
title="dot-matrix-proportional · plotnine · anyplot.ai",
subtitle="Household Solar Panel Adoption Survey · n = 100 homes",
color="",
)
+ theme_void()
+ theme(
plot_background=element_rect(fill=PAGE_BG, color=PAGE_BG),
panel_background=element_rect(fill=PAGE_BG),
plot_title=element_text(color=INK, size=24, ha="left", weight="bold"),
plot_subtitle=element_text(color=INK_SOFT, size=18, ha="left"),
legend_background=element_rect(fill=ELEVATED_BG, color=INK_SOFT),
legend_text=element_text(color=INK_SOFT, size=16),
legend_title=element_text(color=INK, size=16),
legend_key=element_rect(fill=ELEVATED_BG, color="None"),
legend_position="right",
plot_margin=0.05,
)
)
# Save
ggsave(plot, filename=f"plot-{THEME}.png", dpi=300, width=12, height=10)
Runnable source as JSON, for any HTTP client: https://api.anyplot.ai/specs/dot-matrix-proportional/plotnine/code. Any spec id and library id listed in llms-full.txt fit the same URL shape; every URL below is complete and callable.
{
"spec_id": "dot-matrix-proportional",
"language": "python",
"library": "plotnine",
"page": "https://anyplot.ai/dot-matrix-proportional/python/plotnine",
"hub": "https://anyplot.ai/dot-matrix-proportional",
"code_json": "https://api.anyplot.ai/specs/dot-matrix-proportional/plotnine/code",
"spec_json": "https://api.anyplot.ai/specs/dot-matrix-proportional",
"render_light_png": "https://storage.googleapis.com/anyplot-images/plots/dot-matrix-proportional/python/plotnine/plot-light.png",
"render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/dot-matrix-proportional/python/plotnine/plot-dark.png",
"quality_score": 88.0,
"license": "MIT",
"guide": "https://anyplot.ai/llms.txt"
}Part of Dot Matrix Chart for Proportional Counts on anyplot.ai.