Plotting ridgeplots with matplotlib
Project description
ridgeplot-py
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
)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ridgeplot_py-0.2.1rc25-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 882898f902da741f2f2c8dffea9028317ea8a45daa61c697b8b0df05f05b5a51 |
|
MD5 | f32f7755c2d793dd29fbde8e7f8d1f88 |
|
BLAKE2b-256 | 729387cf656c50f041ceccc3ed0b34f3ce36605e0460de961b42716b3736c0fa |