Skip to main content

A grammar of graphics for Python built on Plotly

Project description

GGPLOTLY

A data visualization library for Python that combines the grammar of graphics from ggplot2 with the interactivity of Plotly.

Installation

pip install ggplotly

Usage

from ggplotly import *
import pandas as pd

df = pd.DataFrame({
    'x': [1, 2, 3, 4, 5],
    'y': [1, 2, 3, 4, 5],
    'group': ['A', 'A', 'B', 'B', 'B']
})

# Simple scatter plot
ggplot(df, aes(x='x', y='y')) + geom_point()

# With color mapping and theme
ggplot(df, aes(x='x', y='y', color='group')) + geom_point() + theme_minimal()

# Faceted plot
ggplot(df, aes(x='x', y='y')) + geom_point() + facet_wrap('group')

ggplot2 Function Coverage

Geoms (46)

Function Description
geom_point Scatter plots
geom_line Line plots (sorted by x)
geom_lines Multi-series line plots
geom_path Path plots (unsorted)
geom_bar Bar charts
geom_col Column charts (pre-computed heights)
geom_histogram Histograms
geom_boxplot Box-and-whisker plots
geom_violin Violin plots
geom_density Density plots
geom_area Filled area plots
geom_ribbon Ribbons with ymin/ymax
geom_smooth Smoothed lines (LOESS, linear)
geom_tile Rectangular tiles/heatmaps
geom_rect Rectangles (xmin/xmax/ymin/ymax)
geom_text Text labels
geom_label Text labels with background
geom_errorbar Error bars
geom_segment Line segments
geom_step Step plots
geom_rug Rug plots
geom_jitter Jittered points
geom_vline Vertical reference lines
geom_hline Horizontal reference lines
geom_abline Diagonal lines (slope/intercept)
geom_contour Contour lines
geom_contour_filled Filled contours
geom_map Choropleth maps
geom_sf Simple features (geographic)
geom_range Range plots (min/max/avg)
geom_edgebundle Edge bundling for networks
geom_searoute Maritime shipping routes
geom_sankey Sankey flow diagrams
geom_point_3d 3D scatter plots
geom_surface 3D surface plots
geom_wireframe 3D wireframe plots
geom_candlestick Candlestick charts (financial)
geom_ohlc OHLC charts (financial)
geom_waterfall Waterfall charts (financial)
geom_fanchart Fan charts for uncertainty
geom_stl STL decomposition plots
geom_acf Autocorrelation function plots
geom_pacf Partial autocorrelation plots
geom_norm Normal distribution overlay
geom_qq Q-Q plots (theoretical vs sample quantiles)
geom_qq_line Q-Q reference line through Q1/Q3

Stats (13)

Function Description
stat_identity No transformation
stat_count Count observations
stat_bin Bin data
stat_density Kernel density estimation
stat_ecdf Empirical CDF
stat_smooth Smoothing with CI
stat_summary Summary statistics
stat_contour Contour computation
stat_fanchart Fan chart percentiles
stat_function Apply function to data range
stat_stl STL time series decomposition
stat_qq Compute Q-Q quantiles
stat_qq_line Compute Q-Q reference line

Scales (19)

Function Description
scale_x_continuous Continuous x-axis
scale_y_continuous Continuous y-axis
scale_x_log10 Log10 x-axis
scale_y_log10 Log10 y-axis
scale_x_reverse Reversed x-axis
scale_y_reverse Reversed y-axis
scale_x_date Date x-axis
scale_x_datetime DateTime x-axis
scale_x_rangeslider Interactive range slider for zooming
scale_x_rangeselector Range selector buttons for time series
scale_color_manual Manual color mapping
scale_color_gradient Continuous color gradient
scale_color_brewer ColorBrewer palettes
scale_fill_manual Manual fill mapping
scale_fill_gradient Continuous fill gradient
scale_fill_brewer ColorBrewer fill palettes
scale_fill_viridis_c Viridis color palette
scale_shape_manual Manual shape mapping
scale_size Size scaling

Coordinates (5)

Function Description
coord_cartesian Cartesian coordinates with zoom
coord_fixed Fixed aspect ratio coordinates
coord_flip Flip x and y axes
coord_polar Polar coordinates
coord_sf Spatial/geographic coordinates

Facets (2)

Function Description
facet_wrap Wrap facets into rows/columns
facet_grid 2D facet grid

Themes (9)

Function Description
theme_default Default theme
theme_minimal Minimal theme
theme_classic Classic ggplot2 theme
theme_dark Dark theme
theme_ggplot2 R's ggplot2 default
theme_nytimes New York Times style
theme_bbc BBC News style
theme_custom Custom theme builder
theme Theme modification

Theme Elements (3)

Function Description
element_text Text element styling
element_line Line element styling
element_rect Rectangle element styling

Position Adjustments (7)

Function Description
position_identity No adjustment (identity)
position_dodge Dodge overlapping objects
position_dodge2 Dodge with variable widths
position_jitter Add random noise
position_stack Stack objects
position_fill Stack and normalize to 100%
position_nudge Nudge points by fixed amount

Guides & Labels (7)

Function Description
labs Set plot labels
ggtitle Set title
annotate Add annotations
xlim / ylim / lims Set axis limits
guides Control legend/colorbar display
guide_legend Configure legend appearance
guide_colorbar Configure colorbar appearance

Utilities (2)

Function Description
ggsave Save plots to file
ggsize Set plot dimensions

Other

Function Description
aes Aesthetic mappings
after_stat Reference computed statistics
layer Create custom layers
map_data Load map data
data Access built-in datasets

Total: ~120 ggplot2-equivalent functions

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

ggplotly-0.4.1.tar.gz (4.1 MB view details)

Uploaded Source

Built Distribution

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

ggplotly-0.4.1-py3-none-any.whl (4.3 MB view details)

Uploaded Python 3

File details

Details for the file ggplotly-0.4.1.tar.gz.

File metadata

  • Download URL: ggplotly-0.4.1.tar.gz
  • Upload date:
  • Size: 4.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ggplotly-0.4.1.tar.gz
Algorithm Hash digest
SHA256 47201f6f41c4598563429924b31f7c2742c3f87674d9274898836416d66f31cd
MD5 590fcade726dd5ef5c1fd7f96b878440
BLAKE2b-256 b5ef6451575a99fe428c8a97eda5758e9bd1d21d1846994408182197c88f3889

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggplotly-0.4.1.tar.gz:

Publisher: python-publish.yml on bbcho/ggplotly

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

File details

Details for the file ggplotly-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: ggplotly-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ggplotly-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b3f9a239609262344e7e2f48dbfff19b79d8b7a46b800c3e4093256c4cc6d8db
MD5 0cc0bfa3bb0250bd8126b03003baff69
BLAKE2b-256 2b3ae8dceffc243e14f8a6c8b3688e8bbc90dc7816ff6a24e099d6ac0da84dc9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggplotly-0.4.1-py3-none-any.whl:

Publisher: python-publish.yml on bbcho/ggplotly

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

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