GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • FBumann/xarray_plotly
  • Home
  • Getting Started
  • Plot Types
  • Dataset Plotting
  • Dimensions, Facets & Animation
  • Plotly Express Kwargs
  • Working with Figures
  • Combining Figures
  • Figure Manipulation
  • Fast Bar Charts
  • API Reference

This view

  • Original page
  • New address

GeezerVison is showing fbumann.github.io — xarray_plotly

Home

xarray_plotly ¶

Interactive Plotly Express plotting for xarray.

This package provides a plotly accessor for xarray DataArray and Dataset objects, enabling interactive visualization with Plotly Express.

Features
  • Interactive plots: Zoom, pan, hover, toggle traces
  • Automatic dimension assignment: Dimensions fill slots (x, color, facet) by position
  • Multiple plot types: line, bar, area, scatter, box, imshow
  • Dataset support: Plot all variables at once with "variable" dimension
  • Faceting and animation: Built-in subplot grids and animated plots
  • Customizable: Returns Plotly Figure objects for further modification
Usage

Accessor style::

import xarray_plotly
fig = da.plotly.line()
fig = ds.plotly.line()  # Dataset: all variables

Function style (recommended for IDE completion)::

from xarray_plotly import xpx
fig = xpx(da).line()
fig = xpx(ds).line()  # Dataset: all variables
Example
import xarray as xr
import numpy as np
from xarray_plotly import xpx

da = xr.DataArray(
    np.random.rand(10, 3, 2),
    dims=["time", "city", "scenario"],
)
fig = xpx(da).line()  # Auto: time->x, city->color, scenario->facet_col
fig = xpx(da).line(x="time", color="scenario")  # Explicit
fig = xpx(da).line(color=None)  # Skip slot

# Dataset: plot all variables (accessor or xpx)
ds = xr.Dataset({"temp": da, "precip": da})
fig = xpx(ds).line()  # "variable" dimension for color
fig = xpx(ds).line(facet_col="variable")  # Facet by variable

Next Steps¶

  • Getting Started - Interactive tutorial
  • Plot Types - All available plot types
  • Dimensions & Facets - Control dimension mapping
  • Figure Customization - Customize your figures
  • API Reference - Full API documentation
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.