Skip to main content

Some tools for matplotlib

Project description

mplshared

Some tools for matplotlib.

|PyPI version fury.io| |PyPI license|

.. |PyPI version fury.io| image:: https://badge.fury.io/py/mplshared.svg :target: https://pypi.python.org/pypi/mplshared/

.. |PyPI license| image:: https://img.shields.io/pypi/l/mplshared.svg :target: https://pypi.python.org/pypi/mplshared/

Usage

.. code-block::

pip install --upgrade mplshared

Slope Lines :::::::::::

In plots with linearly scaling axes:

.. code-block:: ipython

import matplotlib.pyplot as plt
from mplshared import SlopeLine

# Get some random data:
x = np.linspace(0, 10, 100)
y = noisify(2 * x + 3)

# Plot it:
plt.plot(x, y)

# Add a slope line:

slope_line = SlopeLine(slope=2, through=(x[5], y[5]), domain=(0, 10))
plt.gca().add_line(slope_line)
plt.show()

.. image:: docs/pyplots/slopeline_linear.png :width: 600 :align: center

If you have a loglog plot, just change the scale argument:

.. code-block:: ipython

slope_line = SlopeLine(slope=2,
                   through=(x[40], y[40]),
                   domain=(1, 100),
                   scale='loglog',
                   style={'color': 'red'}
                   )

.. image:: docs/pyplots/slopeline_loglog.png :width: 600 :align: center

StepFunctionLine

.. code-block:: ipython

import numpy as np
import matplotlib.pyplot as plt

from mplshared import StepFunctionLine

x = np.linspace(-3, 3, 20)
y = np.sin(x)

sf1 = StepFunctionLine(x, y, linewidth=3, color='red')
plt.gca().add_line(sf1)
sf1.autolims(plt)
plt.show()

.. image:: docs/pyplots/stepfunction_1.png :width: 600 :align: center

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

mplshared-0.1.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

mplshared-0.1.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file mplshared-0.1.2.tar.gz.

File metadata

  • Download URL: mplshared-0.1.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.2

File hashes

Hashes for mplshared-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c878d17c03b2e04354c05e0af23fa033198bf4677b81626f31c6acf873d5f601
MD5 2632730e05bdb6e22dab034c585fbe03
BLAKE2b-256 bc9bc13d8364f9de617cb7522e0ea04d394f11352144b9c999b56d5b501fb754

See more details on using hashes here.

File details

Details for the file mplshared-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mplshared-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.2

File hashes

Hashes for mplshared-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c5945199922076c018608a15dfafa007f3595621b0d0e916132d79ea22a04316
MD5 91b6b7ea6c165e3d7e807c936af48012
BLAKE2b-256 2b63055384f717055d7836c884cf1904f55b4867ffaf847486d8341c082ae75f

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