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


Download files

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

Source Distribution

panel-plots-0.1.0.tar.gz (24.5 kB view details)

Uploaded Source

File details

Details for the file panel-plots-0.1.0.tar.gz.

File metadata

  • Download URL: panel-plots-0.1.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for panel-plots-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5181c8c723b9ca6967c7135f7127b3c04a0b6ee7b39c7be69e26b5579f08b4f0
MD5 cc1a7ddbe57ee8a0e847b445f444ad75
BLAKE2b-256 17736d4e94ff51e5a8bf5cdb5bf798dfad9f74a7b0912ce92d2eade3e6e600f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page