Data Visualization Examples

Examples demonstrating visualization and plotting functions for time series and flux data.

24 examples across 10+ plot types.

Examples by Plot Type

Heatmaps

  • plot_heatmap_datetime_basic.py — Datetime heatmaps (vertical/horizontal layouts, value overlay on 6-hourly grids)

  • plot_heatmap_advanced.py — Year-month heatmaps: aggregation method comparison (mean/max/std), rank mode, multi-variable side-by-side

  • plot_heatmap_xyz_basic.py — Pre-aggregated 2D heatmaps from GridAggregator (mean and std, flux binned by temperature and VPD)

Scatter Plots

  • plot_scatter_xy_basic.py — 2D scatter plots showing variable relationships

  • plot_scatter_xy_colored.py — 3D scatter with color coding, binning, and trend visualization

Time Series

  • plot_timeseries.py — Line plots with matplotlib

  • plot_timeseries_interactive.py — Interactive Bokeh plots with zoom, pan, and export

  • plot_timeseries_rangetool.py — Interactive Bokeh plot with a RangeTool overview for navigating long series

Diurnal & Cumulative Patterns

  • plot_dielcycle.py — Diurnal cycles grouped by month or season

  • plot_cumulative_basic.py — Cumulative flux over time with scenario comparison

  • plot_cumulative_year.py — Yearly cumulative sums with reference bands

  • plot_waterfall.py — Daily CO2 uptake/release waterfall building a running flux budget

Distributions

  • plot_histogram_basic.py — Histograms with z-score overlay, peak detection, and custom bin edges

  • plot_histogram_yearly.py — Year-over-year histograms showing temporal patterns

  • plot_shifted_distribution.py — Compare how a variable’s distribution has shifted between a reference and a comparison period (Hansen et al. ±1σ/±3σ zones)

Density & Binning

  • plot_hexbin_basic.py — 2D hexagonal binning with percentile normalization and sparse-bin filtering

  • plot_hexbin_advanced.py — Hexbin plots with absolute values and overlays

  • plot_ridgeline_basic.py — Ridge plots grouped by week

  • plot_ridgeline_advanced.py — Ridge plots grouped by month with styling options

Circular / Spiral

  • plot_treering_temperature.py — Tree-ring spiral: annual data as concentric rings, color = value, month labels around circumference, optional month lines and year separators, colorbar auto-extension

  • plot_treering_line_temperature.py — Tree-ring radial line plot: each year as a line trace around a full circle; radial displacement encodes value; single-color and per-year colormap variants with optional fill between baseline and line

  • plot_windrose_basic.py — Wind rose: a variable aggregated into wind-direction sectors (mean/median/min/max/sum/std/count) drawn as polar bars; baseline handles negative aggregates; the per-sector results table is available on .results and printed as a Rich table

  • plot_compound_extremes.py — CompoundExtremesPlot: quadrant scatter of two standardized drivers (z-scores) coloured/marked by compound-extreme category with dashed threshold lines (after Wang et al., Fig. 2); built from a fitted CompoundExtremes, with custom styling, or from pre-classified data

Other Plots

  • plot_other_plots.py — Long-term anomalies and trend visualization

Two-Phase Design

All plotting classes separate data preparation from presentation:

Phase 1: __init__() takes data and computation parameters.

Phase 2: plot() handles axes, colors, and rendering. Chrome (title, axis labels, units, fonts, grid, legend) is passed as a single FormatStyle via format_style.

This lets you reuse the same data across multiple plots with different visual styles:

scatter = dv.plotting.ScatterXY(x=df['A'], y=df['B'], z=df['C'], nbins=10)
scatter.plot(ax=axes[0], format_style=dv.plotting.FormatStyle(title='View 1'), cmap='viridis')
scatter.plot(ax=axes[1], format_style=dv.plotting.FormatStyle(title='View 2'), cmap='plasma')

Build a FormatStyle once and vary single fields with .merged(**overrides) to keep the same look across plots — see plot_scatter_xy_colored.py.

Available Plot Classes

See dv.plotting for the complete API:

  • HeatmapDateTime — Datetime-aware heatmaps

  • HeatmapXYZ — Pre-aggregated 2D heatmaps

  • HeatmapYearMonth — Year-month aggregation

  • DateTimeSurface — Numeric grid of a series as date × time-of-day

  • ScatterXY — Customizable 2D/3D scatter

  • Cumulative — Cumulative sum plots

  • CumulativeYear — Yearly cumulative analysis

  • WaterfallPlot — Floating bars of sequential contributions to a running total

  • LongtermAnomaliesYear — Yearly anomalies against a reference period

  • TimeSeries — Line plots

  • DielCycle — Diurnal cycle plots

  • HistogramPlot — Distribution histograms

  • HexbinPlot — 2D hexagonal binning

  • RidgeLinePlot — Ridge line plots

  • ShiftedDistributionPlot — Compare a variable’s distribution between two periods

  • TreeRingPlot — Circular spiral: annual rings with color-coded values

  • WindRosePlot — A variable aggregated into wind-direction sectors as polar bars

  • CompoundExtremesPlot — Quadrant scatter of two standardized drivers by extreme category

  • FormatStyle — Chrome (title, labels, units, fonts, grid, legend) for any plot()

Running Examples

# Single example
uv run python examples/visualization/plot_heatmap_datetime_basic.py
uv run python examples/visualization/plot_scatter_xy_colored.py

# All visualization examples
uv run python examples/run_all_examples.py

All 24 examples follow the two-phase design pattern.

Interactive Time Series with a Range Tool

Interactive Time Series with a Range Tool

Cumulative Flux Visualization

Cumulative Flux Visualization

Ridge Line Plotting

Ridge Line Plotting

Diel Cycle Analysis

Diel Cycle Analysis

Waterfall Flux Budget Plot

Waterfall Flux Budget Plot

Basic 2D Scatter Plot

Basic 2D Scatter Plot

Tree-Ring Air Temperature Line Plot

Tree-Ring Air Temperature Line Plot

Advanced Ridge Line Analysis

Advanced Ridge Line Analysis

Interactive Time Series with Bokeh

Interactive Time Series with Bokeh

Yearly Cumulative Summaries

Yearly Cumulative Summaries

Basic Hexbin Plot (Percentile)

Basic Hexbin Plot (Percentile)

Yearly Comparison Histograms

Yearly Comparison Histograms

HeatmapDateTime (Basic)

HeatmapDateTime (Basic)

Shifted Distribution Plot

Shifted Distribution Plot

Wind Rose: Variable by Wind Direction

Wind Rose: Variable by Wind Direction

Anomaly Visualization

Anomaly Visualization

Basic Histogram with Z-Scores

Basic Histogram with Z-Scores

Tree-Ring Air Temperature Plot

Tree-Ring Air Temperature Plot

3D Scatter Plot with Color Coding

3D Scatter Plot with Color Coding

Compound Extremes Quadrant Scatter

Compound Extremes Quadrant Scatter

Time Series Visualization

Time Series Visualization

Advanced Hexbin Plots

Advanced Hexbin Plots

HeatmapXYZ (Basic)

HeatmapXYZ (Basic)

Advanced Heatmap Plots

Advanced Heatmap Plots

Gallery generated by Sphinx-Gallery