Skip to main content

Plotting ridgeplots with matplotlib

Project description

ridgeplot-py

CI codecov PyPI version conda-forge

This is a simple module for plotting ridgeplot with the scipy ecosystem.

Ridgeplot is a great data visualization technique to compare distributions from multiple groups at the same time, and was first introduced in 2017 as joy plot:

I hereby propose that we call these "joy plots" #rstats https://t.co/uuLGpQLAwY

— Jenny Bryan (@JennyBryan) April 25, 2017

ridgeplot-py provides a simple API to produce matplotlib-compatible ridgeplots, as well as a handy ColorEncoder class with scikit-learn syntax for manipulating color annotations in a consistent way [through out manuscripts or presentations].

Install

git clone git@github.com:wckdouglas/ridgeplot-py.git
cd ridgeplot-py
python setup.py install 

or via conda:

conda install -c conda-forge ridgeplot-py

or via pypi:

pip install ridgeplot-py

Usage

from ridgeplot import ridgeplot
from ridgeplot.colors import ColorEncoder, ColorPalette
import numpy as np
import matplotlib.pyplot as plt

# mocking some data
# the input data should be a dict of
# - keys: group names for the distributions
# - values: list of values 
data = {}
for i in range(8):
    data['data_{}'.format(i)] = np.random.randn(100) * (i+1)

# make the plot
fig = plt.figure()
ax = fig.add_subplot(111)
ridgeplot(
    ax, 
    data, 
    xlim=(-20,20), 
    label_size=15
)

img

Example

A notebook showing quick howto is included in this repo!

Build on Apple silicon

scipy may cause error and may be able to solved by the this stackoverflow answer:

brew install openblas
export OPENBLAS="$(brew --prefix openblas)" 
poetry install

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

ridgeplot_py-0.6.1.tar.gz (83.7 kB view details)

Uploaded Source

Built Distribution

ridgeplot_py-0.6.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file ridgeplot_py-0.6.1.tar.gz.

File metadata

  • Download URL: ridgeplot_py-0.6.1.tar.gz
  • Upload date:
  • Size: 83.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for ridgeplot_py-0.6.1.tar.gz
Algorithm Hash digest
SHA256 9060b5131f1f06329d7188323bbbb9368a0bd553e7c334cba9ab185491c8bc4c
MD5 ed8b9f3b83b3b8bc421db50ce3a4a400
BLAKE2b-256 81d8be665acda19e23e46fc7c404fa5134a6cb7b4291904c70dc4192c29688bd

See more details on using hashes here.

File details

Details for the file ridgeplot_py-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: ridgeplot_py-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.3

File hashes

Hashes for ridgeplot_py-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55f34517173599a991ef3d0859f79fce585d399b33d51fc6d03e95f6582835c3
MD5 d7681c4cf1a43c8b5b5dbd818e1fe438
BLAKE2b-256 8691dea0be9233129f6488cc36c096e57ecba781e4ae032e2d5c335a949333cf

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