Skip to main content

Adjust the plotting range of matplotlib.axes.Axes objects to align the origins with the given position

Project description

Build Status Maintainability Test Coverage PyPI Package Documentation Status MIT License

Overview

Matplotlib axes aligner (mpl_axes_aligner) package contains the modules which adjust the plotting range of matplotlib.axes.Axes objects to align their origins.

  • mpl_axes_aligner.shift expands or shifts the plotting range of a matplotlib axis to align the origin with the given position.

  • mpl_axes_aligner.align adjust the plotting range of two matplotlib axes to align their origins with the given position.

Usage

import numpy as np
import matplotlib.pyplot as plt
import mpl_axes_aligner

x = np.arange(0.0, 30, 0.1)
y1 = 0.1 * x * np.sin(x)
y2 = 0.001*x**3 - 0.03*x**2 + 0.12*x

fig = plt.figure()
ax1 = fig.add_subplot(111)
ax2 = ax1.twinx()

ax1.plot(x, y1, color='blue', label='Plot 1')
ax2.plot(x, y2, color='red', label='Plot 2')

# Align y = 0 of ax1 and ax2 with the center of figure.
mpl_axes_aligner.align.yaxes(ax1, 0, ax2, 0, 0.5)

plt.show()
https://github.com/ryutok/mpl_axes_aligner/blob/master/docs/img/intro_plt.png?raw=true

Documentation

https://matplotlib-axes-aligner.rtfd.io

Installation

Install from PyPI:

pip install mpl-axes-aligner

Requirements

  • Python == 2.7, 3.4, 3.5, 3.6

  • Matplotlib == 2.2, 3.0

Python 3.7 may be available, but it is not checked.

Testing

In the top directory of mpl_axes_aligner, install required packages for the tests:

pip install -e .
pip install -e .\[test\]

Run the test programs:

make test

Build documents

In the top directory of mpl_axes_aligner, install required packages for the document building:

pip install -e .
pip install -e .\[doc\]

Build the documents:

make doc

License

MIT License

Author

ryutok

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

mpl_axes_aligner-1.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

mpl_axes_aligner-1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file mpl_axes_aligner-1.2.tar.gz.

File metadata

  • Download URL: mpl_axes_aligner-1.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2

File hashes

Hashes for mpl_axes_aligner-1.2.tar.gz
Algorithm Hash digest
SHA256 8242d10d00d650e26461f623c82485bcc8520fc745bf3fc287d0e4efe450ca51
MD5 a4357d8dc70b59e45df73ad65676c7c5
BLAKE2b-256 9d3c912ffefe7bb0b0619b1b3712279382262de3f52d13df1107ccbbf00a36e9

See more details on using hashes here.

File details

Details for the file mpl_axes_aligner-1.2-py3-none-any.whl.

File metadata

  • Download URL: mpl_axes_aligner-1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.2

File hashes

Hashes for mpl_axes_aligner-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7ad7cba34ba26dbc84fb9242b285edb903b01268a26941cdc7e74f211f74f8c
MD5 95e0e43cb93e4b2c854fea4ab3750a3d
BLAKE2b-256 bf3c4ea2b5801d9565783cf52d723b734aab8446eb62badda7461f4d62bac47f

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