Skip to main content

Figures with precise control over overall width, plot aspect ratio, between-plot spacing, and colorbar dimensions.

Project description

faceted

tests codecov Documentation Status PyPI

Figures with precise control over overall width, overall height, plot aspect ratio, between-plot spacing, and colorbar dimensions.

Description

The purpose of this module is to make it easy to produce single-or-multi-panel figures in matplotlib with strict dimensional constraints. For example, perhaps you would like to make a figure that fits exactly within a column of a manuscript without any scaling, and you would like the panels to be as large as possible, but retain a fixed aspect ratio (height divided by width). Maybe some (or all) of your panels require an accompanying colorbar. With out of the box matplotlib tools this is actually somewhat tricky.

readme-example.png

Internally, this module uses the flexible matplotlib AxesGrid toolkit, with some additional logic to enable making these kinds of dimensionally-constrained panel plots with precise padding and colorbar size(s).

Another project with a similar motivation is panel-plots; however it does not have support for adding colorbars to a dimensionally-constrained figure. One part of the implementation there that inspired part of what is done here is the ability to add user-settable padding to the edges of the figure (to add space for axes ticks, ticklabels, and labels). This eliminates the need for using bbox_inches='tight' when saving the figure, and enables you to make sure that your figures are exactly the dimensions you need for your use.

I intend to keep the scope of this project quite limited. I want the results it produces to remain extremely easy to understand and control. For more complicated figure layouts, e.g. multiple panels with different sizes and aspect ratios, and a more magical approach to setting figure boundary padding and between-panel spacing, a library worth checking out is proplot. The "smart tight layout" feature it provides is an impressive automated method of solving some of the same problems addressed by this library.

For information on how to use faceted, see the documentation: https://faceted.readthedocs.io/en/latest/.

Installation

You can install faceted either from PyPI:

$ pip install faceted

or directly from source:

$ git clone https://github.com/spencerkclark/faceted.git
$ cd faceted
$ pip install -e .

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

faceted-0.2.2.tar.gz (872.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

faceted-0.2.2-py3-none-any.whl (209.1 kB view details)

Uploaded Python 3

File details

Details for the file faceted-0.2.2.tar.gz.

File metadata

  • Download URL: faceted-0.2.2.tar.gz
  • Upload date:
  • Size: 872.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for faceted-0.2.2.tar.gz
Algorithm Hash digest
SHA256 dc50989220d797b60fcf6cc7ae2fadf06abcb068185feca1980c9655142e73fe
MD5 fa084ee133d2e2a0c8930eee594f241a
BLAKE2b-256 4c7380e25351f9543b591fe740f66a1d9aa60104c114c02d020c6f738ac23ef1

See more details on using hashes here.

File details

Details for the file faceted-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: faceted-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 209.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for faceted-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cc742f009a8469f927c4472aab289d4de35476c37c1e87192b34374ac27830f7
MD5 ed9c76c85207d09394f00703967d3517
BLAKE2b-256 ffe2b1e1849ae9cdc957db3f97cd769593a0beb8f9fb6b1dc340da6a4ff7cae2

See more details on using hashes here.

Supported by

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