Skip to main content

Simple library to create corner plots in `matplotlib`.

Project description

Cornerplots

Simple library to create corner plots in matplotlib. Corner plots provide a simple way to visualize multidimensional data, with each dimension plotted against every other dimension. The main goal is to let the user specify data and/or model predictions in arbitrary subsets of the multi-dimensional space and let the code take care of where to plot these values. Originally inspired by corner.py.

Simple example

You might have one set of (w, x, y) data, another set of (x, y, z) data, and a model predicting (w, x, y, z) trajectories.

import numpy as np

t = np.linspace(0, 1)
model = dict(
    w = 3 * t + 1,
    x = 5 * t,
    y = 7 * t**.5,
    z = 3 * t**1.5,
    )

red_data = dict(
    w = np.array([1, 2, 3, 4]),
    x = np.array([0, 2, 4, 5]),
    y = np.array([1, 4, 6, 8]),
    )

blue_data = dict(
    x = np.array([1, 2, 5]),
    y = np.array([3, 5, 7]),
    z = np.array([0, 1, 3]),
    )

In that case, you could plot everything by simply calling:

from cornerplots import Cornerplots
import matplotlib.pyplot as ppl

fig = ppl.figure(figsize = (5,5))

cp = Cornerplots(
    fields = ['w', 'x', 'y', 'z'],
    labels = ['W-value', 'X-value', 'Y-value', 'Z-value'],
    grid_kwargs = {'alpha': 0.25, 'lw': 0.7},
    )

cp.plot(model,     'k-', lw = 1, dashes = (6,2,2,2), label = 'model')
cp.plot(red_data,  'ws', mec = 'r', mew = 1, ms = 5, label = 'red data')
cp.plot(blue_data, 'wD', mec = 'b', mew = 1, ms = 5, label = 'blue data')

cp.legend()

ppl.savefig('example.png')

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

cornerplots-1.0.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

cornerplots-1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file cornerplots-1.0.tar.gz.

File metadata

  • Download URL: cornerplots-1.0.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for cornerplots-1.0.tar.gz
Algorithm Hash digest
SHA256 491a8f0b46e2b2b4ac413a22ea20c080c20193fee61c8c53ad64b395b356323b
MD5 e83ac5e48b5bb319fa148ea07a2e632a
BLAKE2b-256 830803f6b6b2adbd95ea3df345373bb826580e25a8fa65bcf349a7125be36daf

See more details on using hashes here.

File details

Details for the file cornerplots-1.0-py3-none-any.whl.

File metadata

  • Download URL: cornerplots-1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for cornerplots-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a86461d8b38e2cf69f06d22beecea18f30c6f9898f78ab6a332571ec037bdf1c
MD5 8618661a37becdd03a2efb9945871ef7
BLAKE2b-256 eab8e3e783e6e5cda57ea43cae5b96ce96d873a814801dff7c46e75b85f3a7db

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