Skip to main content

ggviews: A ggplot2-style API for holoviews

Python License Documentation

ggviews is a comprehensive Python library that brings the beloved ggplot2 grammar of graphics to Python, built on top of holoviews for interactive visualizations. Create publication-quality plots with the intuitive, layered syntax that R users know and love.

✨ Recent Major Updates (v0.3.0)

  • 🎯 AUTOMATIC LEGENDS: Just like ggplot2 - aes(color='species') now creates legends automatically
  • 📊 STATISTICAL GEOMS: geom_boxplot(), geom_density() for comprehensive analysis
  • 🌈 COLORBREWER INTEGRATION: Professional publication palettes with scale_colour_brewer()
  • 🎛️ ADVANCED THEMING: theme() with element_text(), element_blank() for fine control
  • 🗺️ GEOGRAPHIC MAPPING: geom_map() with multiple projections and features
  • 🔄 COORDINATE SYSTEMS: coord_flip() for horizontal layouts
  • 🔥 2D VISUALIZATION: geom_tile(), geom_raster() for heatmaps and image data
  • 🔧 BUG FIXES: Resolved toolbar duplication, improved notebook display, fixed smooth placement

🎯 60% ggplot2 Coverage Achieved!

Features

✨ Familiar Syntax: Use the same grammar of graphics you know and love from ggplot2 🔗 Method Chaining: Build plots incrementally with intuitive method chaining
🎨 Rich Geoms: Support for all major geom types (point, line, bar, histogram, etc.) 🎭 Themes: Beautiful default themes matching ggplot2's aesthetics 🎯 Faceting: Powerful facet_wrap and facet_grid for subplotting ⚡ Interactive: Leverage holoviews' interactive capabilities 📊 Extensible: Easy to extend with custom geoms and themes

Installation

pip install ggviews

For development installation:

git clone https://github.com/ggviews/ggviews.git
cd ggviews  
pip install -e ".[dev]"

Quick Start

from ggviews import ggplot, aes
import pandas as pd

# Load your data
df = pd.read_csv('your_data.csv')

# Create a beautiful plot with method chaining
(ggplot(df, aes(x='height', y='weight'))
 .geom_point(aes(color='species'), size=3, alpha=0.7)
 .geom_smooth(method='lm')
 .theme_minimal()
 .labs(
     title='Height vs Weight by Species',
     x='Height (cm)', 
     y='Weight (kg)'
 )
 .facet_wrap('~species'))

Core Concepts

Grammar of Graphics

ggviews implements the layered grammar of graphics:

  1. Data: Your pandas DataFrame
  2. Aesthetics: Map data to visual properties (x, y, color, size, etc.)
  3. Geometries: Visual representations of data (points, lines, bars, etc.)
  4. Scales: Control aesthetic mappings
  5. Themes: Overall visual styling
  6. Facets: Subplots based on data subsets

Method Chaining

Build plots incrementally:

plot = (ggplot(data)
        .geom_point()     # Add points
        .geom_line()      # Add lines  
        .theme_classic()  # Apply theme
        .labs(title='My Plot'))  # Add labels

Available Geoms

  • geom_point() - Scatter plots
  • geom_line() - Line plots
  • geom_bar() - Bar charts
  • geom_histogram() - Histograms
  • geom_boxplot() - Box plots
  • geom_violin() - Violin plots
  • geom_density() - Density plots
  • geom_smooth() - Smoothed conditional means
  • geom_area() - Area plots
  • geom_ribbon() - Ribbons/confidence bands
  • geom_tile() - Heatmaps
  • geom_text() - Text annotations

Themes

  • theme_minimal() - Clean, minimal theme
  • theme_classic() - Classic ggplot2 theme
  • theme_bw() - Black and white theme
  • theme_dark() - Dark theme
  • theme_void() - Completely blank theme

Scales

  • scale_color_manual() - Manual color scales
  • scale_color_discrete() - Discrete color scales
  • scale_color_continuous() - Continuous color scales
  • scale_x_continuous() / scale_y_continuous() - Continuous axis scales
  • scale_x_discrete() / scale_y_discrete() - Discrete axis scales

Faceting

Create subplots with:

  • facet_wrap('~variable') - Wrap subplots in a grid
  • facet_grid('row_var ~ col_var') - Grid of subplots

Examples

Basic Scatter Plot

ggplot(df, aes(x='x', y='y')).geom_point()

Colored by Category

ggplot(df, aes(x='x', y='y', color='category')).geom_point()

Multiple Layers

(ggplot(df, aes(x='x', y='y'))
 .geom_point()
 .geom_smooth())

Faceted Plot

(ggplot(df, aes(x='x', y='y'))
 .geom_point() 
 .facet_wrap('~group'))

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

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

Acknowledgments

  • Inspired by Hadley Wickham's ggplot2
  • Built on the excellent holoviews library
  • Thanks to the broader Python data visualization community

Metadata

Release files for ggviews 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ggviews 0.2.0
File Size Uploaded Provenance Actions
ggviews-0.2.0.tar.gz 50.4 kB Without provenance Details for ggviews-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ggviews 0.2.0
File Interpreter ABI Platform Actions
ggviews-0.2.0-py3-none-any.whl Python 3 none any Details for ggviews-0.2.0-py3-none-any.whl

Total release size: 108.9 kB

Release files / ggviews-0.2.0.tar.gz

Download URL ggviews-0.2.0.tar.gz
Size 50.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c1997b783f59720b5d52b3051439125e0d7306d6ef7e374530d4696f3f3d0e7b
BLAKE2b-256 checksum
How to use checksums
a1897054888f4fb2bf9cadaedc1120844e463c130bfcea30735b77176caff22a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / ggviews-0.2.0-py3-none-any.whl

Download URL ggviews-0.2.0-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab835122127297cdadea320ca74bc9eac055b0f062044f64f075811fde707cf1
BLAKE2b-256 checksum
How to use checksums
b4360851d702f58428debae19fddeaba2aa7bcbf7491f5b2fe77a467de288916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for ggviews 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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