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: Basic QR Code Generator in Python, R, Julia and JavaScript.
A QR (Quick Response) code visualization that encodes text or URL data into a square matrix barcode pattern. QR codes are two-dimensional barcodes that store information in a grid of black and white squares, readable by smartphones and dedicated scanners. This visualization is useful for generating scannable codes for quick data sharing and mobile access.

""" anyplot.ai
qrcode-basic: Basic QR Code Generator
Library: plotnine 0.15.7 | Python 3.13.14
Quality: 88/100 | Created: 2026-06-24
"""
import os
import sys
_script_dir = os.path.dirname(os.path.abspath(__file__))
sys.path = [p for p in sys.path if p and os.path.abspath(p) != _script_dir]
import pandas as pd
import qrcode
import qrcode.constants
from plotnine import (
aes,
coord_fixed,
element_rect,
element_text,
geom_tile,
ggplot,
labs,
scale_fill_manual,
theme,
theme_void,
)
# Theme tokens
THEME = os.getenv("ANYPLOT_THEME", "light")
PAGE_BG = "#FAF8F1" if THEME == "light" else "#1A1A17"
INK = "#1A1A17" if THEME == "light" else "#F0EFE8"
INK_SOFT = "#4A4A44" if THEME == "light" else "#B8B7B0"
# QR module colors — dark on light bg / light on dark bg for scannability
MODULE_ON = "#1A1A17" if THEME == "light" else "#F0EFE8"
MODULE_OFF = PAGE_BG # quiet zone matches page background
# Data — encode anyplot.ai URL with error correction level M (15%)
URL = "https://anyplot.ai"
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_M, box_size=1, border=4)
qr.add_data(URL)
qr.make(fit=True)
matrix = qr.get_matrix()
n = len(matrix)
rows = []
for r, row in enumerate(matrix):
for c, val in enumerate(row):
rows.append({"x": c, "y": n - 1 - r, "module": "on" if val else "off"})
df = pd.DataFrame(rows)
# Plot
title = "qrcode-basic · python · plotnine · anyplot.ai"
plot = (
ggplot(df, aes(x="x", y="y", fill="module"))
+ geom_tile(width=1.02, height=1.02)
+ scale_fill_manual(values={"on": MODULE_ON, "off": MODULE_OFF})
+ coord_fixed()
+ labs(title=title, subtitle=URL)
+ theme_void()
+ theme(
figure_size=(6, 6),
plot_background=element_rect(fill=PAGE_BG, color=PAGE_BG),
panel_background=element_rect(fill=PAGE_BG),
plot_title=element_text(color=INK, size=12, ha="center"),
plot_subtitle=element_text(color=INK_SOFT, size=9, ha="center"),
legend_position="none",
)
)
# Save
plot.save(f"plot-{THEME}.png", dpi=400, width=6, height=6, units="in")
Runnable source as JSON, for any HTTP client: https://api.anyplot.ai/specs/qrcode-basic/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": "qrcode-basic",
"language": "python",
"library": "plotnine",
"page": "https://anyplot.ai/qrcode-basic/python/plotnine",
"hub": "https://anyplot.ai/qrcode-basic",
"code_json": "https://api.anyplot.ai/specs/qrcode-basic/plotnine/code",
"spec_json": "https://api.anyplot.ai/specs/qrcode-basic",
"render_light_png": "https://storage.googleapis.com/anyplot-images/plots/qrcode-basic/python/plotnine/plot-light.png",
"render_dark_png": "https://storage.googleapis.com/anyplot-images/plots/qrcode-basic/python/plotnine/plot-dark.png",
"quality_score": 88.0,
"license": "MIT",
"guide": "https://anyplot.ai/llms.txt"
}Part of Basic QR Code Generator on anyplot.ai.