# Testing a Chart Without Looking at It

A chart function that returns its Figure and Axes can be tested like any other function, by reading what the Axes holds, its title, axis labels, each bar's height and a line's data, with matplotlib's Agg backend set in conftest.py and every figure closed with plt.close.

![Cheat sheet: Testing a Chart Without Looking at It](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/59cccc0d6ae54a8cb03ff5e6410e0fe6.webp)

- Category: Data Analysis
- Level: Journeyman
- Tags: &lt;figure>, Agg Backend, Axes, conftest.py, plt.close(), python
- Author: Gregor Dzierzon
- Updated: November 23, 2026

Source: https://www.ask-codey.com/cheat-sheets/data-testing-charts-cheat-sheet
