← Dashboard

data science / data visualization

Learn Data Visualization Free: Pick the Chart, Then the Library

A 6% difference can be drawn as a 150% gap with one line of code. This page shows how, gives a chart-by-question table, compares the Python, R and JavaScript libraries by what they are for, and links the free guides and galleries that teach design rather than syntax.

updated Nov 2026·a 10-minute read·Matplotlib 3.11 example

Most beginners start by choosing a plotting library, learning its syntax and then wondering why their charts look wrong. The better order is to decide what the reader should compare, choose the chart form that makes that comparison easy, and only then pick a tool. Library choice is a small decision, because all of them can draw a bar chart. The mistakes that matter are in the axes, the encodings and the colors, and a library will not warn you about them.

01 · ONE LINE OF CODE

The same two numbers, drawn honestly and dishonestly

Two plans score 52 and 55. The difference is 3 points, or about 5.8%. This Matplotlib script draws the pair twice, once with the vertical axis starting at 50 and once at 0:

axis.pyMatplotlib 3.11
import matplotlib.pyplot as plt

vals = {"Plan A": 52, "Plan B": 55}
fig, (a, b) = plt.subplots(1, 2, figsize=(7, 3))
a.bar(vals.keys(), vals.values()); a.set_ylim(50, 56); a.set_title("axis starts at 50")
b.bar(vals.keys(), vals.values()); b.set_ylim(0, 60);  b.set_title("axis starts at 0")
fig.savefig("axis.png")

A bar encodes its value by its length, so what the reader compares is the ratio of the two bar heights on the page. Here are the drawn heights as a fraction of the plot area:

Drawn bar heights, as a share of the plot's height
Axis rangePlan A barPlan B barB looks this many times taller
50 to 560.3330.8332.5x
0 to 600.8670.9171.06x

The true ratio is 55 / 52 = 1.058. The truncated axis makes the gap look 2.5 times as large as the zero-based one. The rule: bars start at zero, always, because their length is the data. Lines and dots encode by position rather than length, so a line chart of a slowly changing value can use a tighter range as long as the axis is labeled and the choice is defensible.

WATCHDefaults are not decisions. Libraries pick axis limits and colors for you, and the result is sometimes misleading. Check every chart for three things before sharing it: where each axis starts, what each color encodes, and whether a reader could draw the opposite conclusion from the picture.

02 · CHART BY QUESTION

Start from what the reader should compare

Question to chart form
The reader should seeUseAvoid
Which category is largerSorted horizontal bars from zeroPies with many slices; 3D bars
How a value changes over timeLine chartBars for dozens of time points
How values are spreadHistogram, box plot, or densityA mean bar with no spread
Whether two variables move togetherScatter plotDual-axis lines that imply a link
Parts of a whole across a few groupsStacked bar or a small tablePie charts with near-equal slices

If you cannot say which row your chart belongs to, the chart is probably not ready. From Data to Viz turns this table into a decision tree: pick your data type and it lists the chart forms that fit, with code and a page of common caveats.

03 · LIBRARIES

Which library for which job

Versions shown on each project's site, October 2026
LibraryLanguageBest for
Matplotlib 3.11PythonFull control; static figures for papers and reports; the base layer for pandas plotting and seaborn
seaborn 0.13PythonStatistical charts from DataFrames in a few lines
Altair 6.3 / PlotlyPythonInteractive charts; Altair is declarative and built on Vega-Lite
ggplot2 4.0RLayered grammar of graphics; the default in R data work
D3 7.9JavaScriptBespoke interactive graphics on the web, with a steeper learning curve
Observable PlotJavaScriptQuick exploratory charts in the browser with far less code than D3

If you already use Python, start with Matplotlib's quick start, then seaborn. If you work in R, go straight to ggplot2, covered on the R guide. Choose D3 only when you need custom interaction on a web page; it is a toolkit, not a chart library.

04 · GALLERIES

Galleries to steal from

Reproducible code beside the finished chart is the fastest way to learn what a library can do. Open a gallery, find a chart close to the one in your head, copy the code and change the data.

05 · TRY IT

Redraw a chart you saw this week

TRY ITFind a chart from a news article or a company report. Write down the question it answers, then check the axes and colors against the table in section 02. Rebuild it from a small dataset in Matplotlib or ggplot2, first the way the original was drawn and then the way you would draw it. Put both side by side and describe the difference in one sentence a coworker would understand.

06 · FAQ

Frequently asked questions

Should bar charts always start at zero?

Yes. A bar encodes its value by length, so truncating the axis exaggerates differences: in the example above, a 5.8% gap looked 2.5 times as large. Line charts encode by position and can use a tighter range if the axis is clearly labeled.

Which data visualization library should I learn first?

Use Matplotlib and seaborn if you work in Python, and ggplot2 if you work in R. Learn D3 only when you need custom interactive graphics on a web page, since it is a lower-level toolkit.

How do I choose the right chart type?

Start from the comparison you want the reader to make: category sizes call for bars, change over time for lines, spread for histograms or box plots, and relationships between variables for scatter plots. From Data to Viz offers a decision tree built on this idea.

Where can I find chart code to copy and adapt?

The Python Graph Gallery, the R Graph Gallery and the official Matplotlib gallery all show finished charts with reproducible code. Find one close to the chart you want and swap in your own data.