Skip to main content

Beautiful raincloud plots for Python

Project description

raincloudpy 🌧️☁️

PyPI version License: MIT Python 3.7+

Beautiful raincloud plots for Python, combining boxplots, half-violin plots, and density-aligned scatter plots to create comprehensive and visually appealing data visualizations.

What is a Raincloud Plot?

Raincloud plots are a hybrid visualization that combines:

  • 📊 Box plots - showing quartiles and outliers
  • 🎻 Half-violin plots - displaying the probability density
  • 🔴 Scatter plots - showing individual data points aligned by density

This creates a "rain cloud" effect that provides maximum information about your data distribution.

Installation

pip install raincloudpy

Quick Start

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from raincloudpy import raincloudplot

# Create sample data
df = pd.DataFrame({
    'group': ['A'] * 50 + ['B'] * 50 + ['C'] * 50,
    'value': np.concatenate([
        np.random.randn(50) + 2,
        np.random.randn(50) + 3,
        np.random.randn(50) + 2.5
    ])
})

# Create raincloud plot
fig, ax = plt.subplots(figsize=(10, 6))
raincloudplot(data=df, x='group', y='value', palette='Set2', ax=ax)
plt.title('My First Raincloud Plot')
plt.show()

Features

  • 🎨 Customizable colors - Use any seaborn color palette or custom colors
  • 📏 Flexible sizing - Control box width, violin width, and dot sizes
  • 🎯 Density-aligned scatter - Points are intelligently positioned based on data density
  • 🔧 Component control - Show/hide individual components (box, violin, scatter)
  • 📊 Works with pandas - Seamless integration with pandas DataFrames
  • 🎭 Matplotlib-based - Fully compatible with matplotlib customization

Advanced Usage

Customized Plot

raincloudplot(
    data=df, 
    x='group', 
    y='value',
    order=['A', 'B', 'C'],
    palette=['#FF6B6B', '#4ECDC4', '#45B7D1'],
    box_width=0.2,
    violin_width=0.35,
    dot_size=10,
    dot_spacing=0.03,
    y_threshold=0.1,
    box_kwargs={'linewidth': 3},
    violin_kwargs={'alpha': 0.3},
    scatter_kwargs={'alpha': 0.9, 'edgecolor': 'black'}
)

Hiding Components

# Only show violin and scatter
raincloudplot(
    data=df, 
    x='group', 
    y='value',
    show_box=False,
    show_violin=True,
    show_scatter=True
)

Parameters

Parameter Type Default Description
data DataFrame None Input data (required)
x str None Column name for categorical variable
y str None Column name for continuous variable
order list None Order to plot categorical levels
palette str/list None Colors for different groups
ax Axes None Matplotlib axes object
box_width float 0.15 Width of boxplot boxes
violin_width float 0.3 Maximum width of violin plot
dot_size float 7 Size of scatter points
dot_spacing float 0.03 Horizontal spacing between dots
y_threshold float None Threshold for grouping y-values (absolute); 5% when set to None
n_bins int 40 Number of bins for density estimation
box_kwargs dict None Additional boxplot arguments
violin_kwargs dict None Additional violin plot arguments
scatter_kwargs dict None Additional scatter plot arguments
show_box bool True Whether to show boxplot
show_violin bool True Whether to show violin plot
show_scatter bool True Whether to show scatter plot
orient str 'v' Plot orientation ('v' or 'h')

Requirements

  • Python >= 3.7
  • numpy >= 1.19.0
  • matplotlib >= 3.3.0
  • scipy >= 1.5.0
  • pandas >= 1.1.0
  • seaborn >= 0.11.0

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use this package in your research, please cite:

@software{raincloudpy2025,
  author = {Basile Garcia},
  title = {raincloudpy: Beautiful raincloud plots for Python},
  year = {2025},
  url = {https://github.com/yourusername/raincloudpy}
}

Acknowledgments

Inspired by the original raincloud plots concept and various implementations in R and Python.

References

  • Allen, M., Poggiali, D., Whitaker, K., Marshall, T. R., & Kievit, R. A. (2019). Raincloud plots: a multi-platform tool for robust data visualization. Wellcome Open Research, 4.

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

raincloudpy-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

raincloudpy-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: raincloudpy-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for raincloudpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a5eef2d816d6beb591dbe628c032e98af5a6cd4383bb9e4072008c8357cb46a
MD5 fe641e700789626d6fc5481ac9d764fc
BLAKE2b-256 4dd71dcefb609ab326b8085d2f1f1a8f03e0d9853634a2862386af20941a756c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raincloudpy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for raincloudpy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23368b3abf6d5197344f6564a0bd7f12bc47009798a7a4f062d57035ac805a31
MD5 0870d60612e0c3b941f2b05d3ae255f8
BLAKE2b-256 9ef5150efdf60eb193869d281c4005149cbf7e98aca6e0570f2fe2706ec1cc2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page