Data Visualization

pygal

Charts that stay crisp no matter how far you zoom in, because they're math, not pictures.

Install it: pip install pygal

What does it do?

Pygal draws charts as SVG files, a format built from mathematical shapes and coordinates rather than a grid of colored dots like a JPEG. That means a bar chart it makes looks exactly as sharp printed on a poster as it does on a phone screen, because it’s redrawn from instructions every time instead of stretched from a fixed image. It covers the usual suspects — bar charts, pie charts, line graphs, radar charts — and each one is interactive out of the box, so hovering over a bar pops up its exact value. It’s a small, focused library built for one job: pretty, scalable charts with minimal setup.

See it in action

This code creates a bar chart of monthly sales figures and saves it as a sharp, scalable image file.

import pygal

chart = pygal.Bar()
chart.title = "Monthly Sales"
chart.x_labels = ["Jan", "Feb", "Mar", "Apr"]
chart.add("Revenue", [1000, 1500, 1200, 1800])
chart.render_to_file("sales_chart.svg")

Why would a non-developer care?

Anyone who has zoomed into a chart in a PDF or presentation and watched it turn into a blurry mess knows the problem Pygal solves. Because its output is vector-based, the same chart can go into a printed annual report and a website without looking different or needing to be regenerated at another resolution. That’s a small but real quality difference in any document meant to be read closely or printed large.

Real-world examples

Pygal shows up in reporting tools and internal dashboards where output needs to be embedded directly into web pages as clean, scalable graphics rather than static images. Publications and technical reports that need charts to survive resizing or printing often lean on SVG-based tools like this one instead of Matplotlib’s raster output. Without vector output, a chart good enough for a laptop screen can turn pixelated the moment someone projects it on a conference room screen.

Who uses it

Developers building lightweight reporting tools or websites who want interactive, print-quality charts without pulling in a heavier visualization stack.

How it compares to alternatives

Compared to Matplotlib, which is more powerful but produces raster images by default, Pygal’s SVG-first approach trades some flexibility for sharper, web-friendly output. Plotly and Bokeh offer richer interactivity but come with a much bigger footprint. D3.js does something similar in JavaScript, but Pygal lets a Python-only project stay Python-only.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries