Skip to main content

cbrviz

Small, composable Matplotlib building blocks for statistical figures — strip/box plots with p-value annotation, KDE ridges and split violins, XY panels with correlation and zoom, dot plots / correlation plots, and Kaplan-Meier curves.

Every class is a thin wrapper around a validated DataFrame plus a handful of ax-based draw methods, so you keep full control of the figure.

Install

pip install cbrviz

Two statistics back-ends are optional:

pip install "cbrviz[survival]"   # KME  (scikit-survival)
pip install "cbrviz[stats]"      # StripBox.calc_pairwise_p  (scikit-posthocs)
pip install "cbrviz[all]"        # both

Quickstart

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from cbrviz import StripBox

rng = np.random.default_rng(0)
df = pd.DataFrame({
    "expression": np.concatenate([rng.normal(m, 1, 30) for m in (5.0, 6.5, 5.2)]),
    "genotype":   np.repeat(["WT", "KO", "Rescue"], 30),
})

sb = StripBox(df, s1_order=["WT", "KO", "Rescue"])

fig, ax = plt.subplots()
sb.boxplt(ax=ax, showfliers=False)
sb.add_strips(ax=ax, s=12)
sb.add_global_p(ax=ax)
sb.calc_pairwise_p(posthoc_method="dunn")   # needs cbrviz[stats]
sb.add_pair_p("WT", "KO", ax=ax)

usage() — a runnable example for every class

Not sure how a class works? Ask it:

>>> from cbrviz import Ridge
>>> Ridge.usage()
# Typical use of Ridge
import numpy as np
...

Modules

import what it draws
StripBox, SplitStripBox, PairedStripBox box + strip plots, global & pairwise p-values
KDE, KDE2D, Ridge, SplitViolin 1-D / 2-D kernel density, ridgeline, split violin
XYview, XYpairs, XYzoom scatter with correlation / regression / labelled points / zoom inset
Dotplot, Corrplot grid dot plots and clustered correlation plots
KME Kaplan-Meier curves, log-rank, pairwise log-rank heatmap (needs cbrviz[survival])
resolve_categories, resolve_colors helpers for level ordering and palette resolution

Heatmap (cbrviz.heatmap) is a placeholder and raises NotImplementedError.

Development

git clone https://github.com/fossbert/cbrviz
cd cbrviz
pip install -e ".[test]"
pytest

License

MIT — see LICENSE.

Download files

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

Source Distribution

cbrviz-0.1.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cbrviz-0.1.0-py3-none-any.whl (42.1 kB view details)

Uploaded Python 3

File details

Details for the file cbrviz-0.1.0.tar.gz.

File metadata

  • Download URL: cbrviz-0.1.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cbrviz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 793ba945d952837c385aee5f5066d376f577e5893b4ed26e8b98f98a54f2e04d
MD5 d5bda2699c2a486c7f2fd7c8b47efaee
BLAKE2b-256 77596dfb8b9c1b135970bf09618535001d8c07bd20ce332c6748bcb09841434b

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbrviz-0.1.0.tar.gz:

Publisher: release.yml on fossbert/cbrviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cbrviz-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cbrviz-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cbrviz-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2dac9b975524e4282a5b8d39b8b2d15eae41180641cbd08de951a16ee19736de
MD5 4f0d5d90f442902fc0453cdffbe73b2b
BLAKE2b-256 111824b745de22eea45ed3a0a9c3686e57346303fe8024e48b973d3d652ae29c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cbrviz-0.1.0-py3-none-any.whl:

Publisher: release.yml on fossbert/cbrviz

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page