Skip to main content

Organize matplotlib plots in panels

Project description

A simple to use and understand system for making panel plots with matplotlib. The panel-plots package is designed to make it easy to create panel plots with specific sizes, either panel size or overall figure size, maing it particularly suitable for generating figures for journal articles where you need to prepare an image of a particular size and ensure consistent and correct font sizing.

Getting started

The panel-plots package only manages location information, it leaves everything else up to you (and matplotlib). A simple example is to create a 2x3 panel plot of a specified total width. Rremember, knowing the width of the plot allows you to select the same font size as in your document and know the fonts will work out being the same size:

import matplotlib.pyplot as plt
from panels import FigureSizeLocator

loc = FigureSizeLocator(2, 3, figwidth=150, hsep=12, vsep=12,
                        padleft=10, padright=10, padtop=10, padbottom=10)
fig = plt.figure(figsize=loc.figsize)

for i, pos in enumerate(loc.panel_position_iterator()):
    ax = fig.add_axes(pos)
    ax.plot([0, 1, 2], [3, 2, 1])
    ax.set_title('Panel #{}'.format(i))

plt.show()

You can do a similar thing but specify the size of the individual panels using the PanelSizeLocator locator.

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for panel-plots, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size panel-plots-0.1.0.tar.gz (24.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page