Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
k-diagram v1.2.0
Logo
k-diagram v1.2.0

Documentation Contents:

  • Installation
  • Quick Start Guide
  • Motivation and Background
  • User Guide
    • Visualizing Forecast Uncertainty
    • Model Evaluation with Taylor Diagrams
    • Model Comparison Visualization
    • Feature Importance Visualization
    • Visualizing Relationships
    • Visualizing Forecast Errors
    • Visualizing 1D Distributions
    • Datasets
    • Utility Functions
    • Case Study: Zhongshan Land Subsidence Uncertainty
  • Command-Line Interface (CLI)
  • Gallery
    • Uncertainty Visualizations
    • Model Evaluation Gallery (Taylor Diagrams)
    • Model Comparison Gallery
    • Feature-Based Visualization Gallery
    • Relationship Visualization
    • Error Visualizations
    • Histogram Gallery
    • Utility Function Examples
  • API Reference
    • kdiagram.plot.uncertainty.plot_actual_vs_predicted
    • kdiagram.plot.uncertainty.plot_anomaly_magnitude
    • kdiagram.plot.uncertainty.plot_coverage
    • kdiagram.plot.uncertainty.plot_coverage_diagnostic
    • kdiagram.plot.uncertainty.plot_interval_consistency
    • kdiagram.plot.uncertainty.plot_interval_width
    • kdiagram.plot.uncertainty.plot_model_drift
    • kdiagram.plot.uncertainty.plot_temporal_uncertainty
    • kdiagram.plot.uncertainty.plot_uncertainty_drift
    • kdiagram.plot.uncertainty.plot_velocity
    • kdiagram.plot.uncertainty.plot_radial_density_ring
    • kdiagram.plot.uncertainty.plot_polar_heatmap
    • kdiagram.plot.uncertainty.plot_polar_quiver
    • kdiagram.plot.evaluation.taylor_diagram
    • kdiagram.plot.evaluation.plot_taylor_diagram_in
    • kdiagram.plot.evaluation.plot_taylor_diagram
    • kdiagram.plot.errors.plot_error_bands
    • kdiagram.plot.errors.plot_error_violins
    • kdiagram.plot.errors.plot_error_ellipses
    • kdiagram.plot.comparison.plot_model_comparison
    • kdiagram.plot.comparison.plot_reliability_diagram
    • kdiagram.plot.comparison.plot_horizon_metrics
    • kdiagram.plot.feature_based.plot_feature_fingerprint
    • kdiagram.plot.relationship.plot_relationship
    • kdiagram.utils.build_q_column_names
    • kdiagram.utils.detect_quantiles_in
    • kdiagram.utils.melt_q_data
    • kdiagram.utils.pivot_q_data
    • kdiagram.utils.reshape_quantile_data
    • kdiagram.utils.plot_hist_kde
    • kdiagram.datasets.load_uncertainty_data
    • kdiagram.datasets.load_zhongshan_subsidence
    • kdiagram.datasets.make_cyclical_data
    • kdiagram.datasets.make_fingerprint_data
    • kdiagram.datasets.make_multi_model_quantile_data
    • kdiagram.datasets.make_taylor_data
    • kdiagram.datasets.make_uncertainty_data
  • Contributing
  • Code of Conduct
  • Citing k-diagram
  • Release Notes
    • Version 1.2.0
    • Version 1.1.0
    • Version 1.0.3
    • Version 1.0.0
  • License
  • Glossary
  • References
Back to top
View this page
Edit this page

Model Evaluation Gallery (Taylor Diagrams)¶

This gallery page focuses on Taylor Diagrams, which provide a concise visual summary of model performance. They compare key statistics like correlation, standard deviation, and centered Root Mean Square Difference (RMSD) between one or more models (or predictions) and a reference (observed) dataset.

Note

You need to run the code snippets locally to generate the plot images referenced below (e.g., images/gallery_taylor_diagram_rwf.png). Ensure the image paths in the .. image:: directives match where you save the plots (likely an images subdirectory relative to this file).

Taylor Diagram (Flexible Input & Background)¶

Uses taylor_diagram(). This example shows its flexibility by accepting raw data arrays and adding a background colormap based on the ‘rwf’ (Radial Weighting Function) strategy, emphasizing points with good correlation and reference-like standard deviation.

 1# Assuming plot functions are in kd.plot.evaluation
 2import kdiagram.plot.evaluation as kde
 3import numpy as np
 4import matplotlib.pyplot as plt
 5
 6# --- Data Generation ---
 7np.random.seed(101)
 8n_points = 150
 9reference = np.random.normal(0, 1.0, n_points) # Ref std dev approx 1.0
10
11# Model A: High correlation, slightly lower std dev
12pred_a = reference * 0.8 + np.random.normal(0, 0.4, n_points)
13# Model B: Lower correlation, higher std dev
14pred_b = reference * 0.5 + np.random.normal(0, 1.1, n_points)
15# Model C: Good correlation, similar std dev
16pred_c = reference * 0.95 + np.random.normal(0, 0.3, n_points)
17
18y_preds = [pred_a, pred_b, pred_c]
19names = ["Model A", "Model B", "Model C"]
20
21# --- Plotting ---
22kde.taylor_diagram(
23    y_preds=y_preds,
24    reference=reference,
25    names=names,
26    cmap='Blues',             # Add background shading
27    radial_strategy='rwf',    # Use RWF strategy for background
28    norm_c=True,              # Normalize background colors
29    title='Gallery: Taylor Diagram (RWF Background)',
30    # Save the plot (adjust path relative to this file)
31    savefig="images/gallery_taylor_diagram_rwf.png"
32)
33plt.close()
Taylor Diagram with RWF Background Example

🧠 Analysis and Interpretation

The Taylor Diagram summarizes model skill by plotting standard deviation (radius) vs. correlation (angle) relative to a reference (red marker/arc at reference std dev = 1.0, angle = 0). Points closer to the reference point indicate better overall performance (lower centered RMSD).

This implementation uses the Radial Weighting Function (RWF) strategy for the background colormap (normalized blues).

Analysis and Interpretation:

  • Reference Point: The red marker at radius ~1.0 on the horizontal axis represents the reference data’s variability.

  • Background (RWF): Darker blue shades highlight regions with both high correlation (small angle) and standard deviation close to the reference (radius near 1.0).

  • Model Performance:

    • Model A (Red Dot): High correlation (~0.85), slightly low std dev (~0.8). Good pattern match, slightly low variability.

    • Model B (Blue Dot): Low correlation (~0.5), high std dev (~1.2). Poor pattern match and wrong variability.

    • Model C (Green Dot): Very high correlation (~0.95), std dev very close to reference (~1.0). Best overall fit, landing in the darkest blue region.

💡 When to Use:

  • Use this plot (taylor_diagram) when you need flexibility: you can provide pre-calculated stats or raw data.

  • The background (cmap + radial_strategy) adds context. ‘rwf’ specifically helps identify models that match both correlation and standard deviation well.

  • Ideal for comparing multiple models against observations in fields like climate science or hydrology.


Taylor Diagram (Background Shading Focus)¶

Uses plot_taylor_diagram_in(). This example highlights the background colormap feature, here using the ‘convergence’ strategy where color intensity relates directly to the correlation coefficient. It also demonstrates changing the plot orientation (Corr=1 at North, angles increase counter-clockwise).

 1import kdiagram.plot.evaluation as kde
 2import numpy as np
 3import matplotlib.pyplot as plt
 4
 5# --- Data Generation (reusing from previous example) ---
 6np.random.seed(101)
 7n_points = 150
 8reference = np.random.normal(0, 1.0, n_points)
 9pred_a = reference * 0.8 + np.random.normal(0, 0.4, n_points)
10pred_b = reference * 0.5 + np.random.normal(0, 1.1, n_points)
11pred_c = reference * 0.95 + np.random.normal(0, 0.3, n_points)
12y_preds = [pred_a, pred_b, pred_c]
13names = ["Model A", "Model B", "Model C"]
14
15# --- Plotting ---
16kde.plot_taylor_diagram_in(
17    *y_preds,                     # Pass predictions as separate args
18    reference=reference,
19    names=names,
20    radial_strategy='convergence',# Background color shows correlation
21    cmap='viridis',
22    zero_location='N',            # Place Corr=1 at the Top (North)
23    direction=1,                  # Counter-clockwise angles
24    cbar=True,                    # Show colorbar for correlation
25    title='Gallery: Taylor Diagram (Correlation Background, N-oriented)',
26    # Save the plot (adjust path relative to this file)
27    savefig="images/gallery_taylor_diagram_in_conv.png"
28)
29plt.close()
Taylor Diagram with Correlation Background Example

🧠 Analysis and Interpretation

This version (plot_taylor_diagram_in) emphasizes the background color map and offers flexible orientation. Here, the background uses the viridis colormap with the ‘convergence’ strategy, meaning color directly maps to the correlation value (yellow = high, purple = low). The plot is oriented with perfect correlation (1.0) at the top (‘N’).

Analysis and Interpretation:

  • Orientation: Correlation decreases as the angle increases counter-clockwise from the top ‘N’ position. Standard deviation increases radially outwards. The red reference arc is at radius ~1.0.

  • Background (Convergence): The yellow region near the top indicates correlations close to 1.0. Colors shift towards green/blue/purple as correlation decreases (angle increases).

  • Model Performance:

    • Model A (Red Dot): Good correlation (in greenish-yellow zone), std dev slightly below reference arc.

    • Model B (Blue Dot): Low correlation (in blue/purple zone), std dev slightly above reference arc.

    • Model C (Green Dot): Excellent correlation (in bright yellow zone), std dev very close to reference arc.

💡 When to Use:

  • Choose plot_taylor_diagram_in when you want a strong visual guide for correlation levels provided by the background shading.

  • Useful for presentations where the background color helps direct the audience’s focus to high-correlation regions.

  • Use the orientation options (zero_location, direction) to match specific conventions or visual preferences.


Taylor Diagram (Basic Plot)¶

Uses plot_taylor_diagram(). This example shows a more standard Taylor Diagram layout without background shading, focusing purely on the positions of the model points relative to the reference. Uses a half-circle layout (90 degrees, showing positive correlations only) with default West orientation for Corr=1.

 1import kdiagram.plot.evaluation as kde
 2import numpy as np
 3import matplotlib.pyplot as plt
 4
 5# --- Data Generation (reusing from previous example) ---
 6np.random.seed(101)
 7n_points = 150
 8reference = np.random.normal(0, 1.0, n_points)
 9pred_a = reference * 0.8 + np.random.normal(0, 0.4, n_points)
10pred_b = reference * 0.5 + np.random.normal(0, 1.1, n_points)
11pred_c = reference * 0.95 + np.random.normal(0, 0.3, n_points)
12y_preds = [pred_a, pred_b, pred_c]
13names = ["Model A", "Model B", "Model C"]
14
15# --- Plotting ---
16kde.plot_taylor_diagram(
17    *y_preds,
18    reference=reference,
19    names=names,
20    acov='half_circle',      # Use 90-degree layout
21    zero_location='W',       # Place Corr=1 at the Left (West)
22    direction=-1,            # Clockwise angles
23    title='Gallery: Basic Taylor Diagram (Half Circle)',
24    # Save the plot (adjust path relative to this file)
25    savefig="images/gallery_taylor_diagram_basic.png"
26)
27plt.close()
Basic Taylor Diagram Example

🧠 Analysis and Interpretation

This basic Taylor Diagram presents a clean comparison of model skill without background shading, using a 90-degree arc (acov='half_circle') focused on positive correlations. Perfect correlation (1.0) is on the left (West axis, zero_location='W'), and correlation decreases clockwise (direction=-1).

Analysis and Interpretation:

  • Reference Arc: The red arc shows the standard deviation of the reference data (approx. 1.0).

  • Model Positions:

    • Model A (Red Dot): High correlation (small angle relative to West axis), standard deviation below the reference arc (~0.8). Underestimates variability.

    • Model B (Blue Dot): Lower correlation (larger angle), standard deviation above the reference arc (~1.2). Overestimates variability and has poorer pattern match.

    • Model C (Green Dot): Highest correlation (smallest angle), standard deviation almost exactly on the reference arc (~1.0). Best overall model in this comparison.

  • RMSD: Model C is closest to the reference point (at radius ~1.0 on the West axis), indicating the lowest centered RMS difference. Model B is furthest away.

💡 When to Use:

  • Use this basic plot for a clear, uncluttered view focused purely on the standard deviation and correlation metrics.

  • Ideal when comparing many models where background shading might become too busy.

  • Suitable for publications preferring a standard, minimalist Taylor Diagram representation.


Taylor Diagram (NE Orientation, Convergence BG)¶

Another variant using plot_taylor_diagram_in(), this time placing perfect correlation (1.0) in the North-East (‘NE’) quadrant, with angles increasing counter-clockwise (direction=1). The background uses the ‘convergence’ strategy with the ‘Purples’ colormap, where color intensity maps directly to the correlation value, and includes a colorbar.

 1import kdiagram.plot.evaluation as kde
 2import numpy as np
 3import matplotlib.pyplot as plt
 4
 5# --- Data Generation (using same data as previous examples) ---
 6np.random.seed(42) # Use same seed for consistency if desired
 7reference = np.random.normal(0, 1, 100)
 8y_preds = [
 9    reference + np.random.normal(0, 0.3, 100), # Model A (close)
10    reference * 0.9 + np.random.normal(0, 0.8, 100) # Model B (worse corr/std)
11]
12names = ['Model A', 'Model B']
13
14# --- Plotting ---
15kde.plot_taylor_diagram_in(
16    *y_preds,
17    reference=reference,
18    names=names,
19    acov='half_circle', # 90 degree span
20    zero_location='NE', # Corr = 1.0 at North-East
21    direction=1,        # Angles increase counter-clockwise
22    fig_size=(8, 8),
23    cbar=True,          # Show colorbar for correlation
24    cmap='Purples',       # Use Purples colormap for background
25    radial_strategy='convergence', # Color based on correlation
26    title='Gallery: Taylor Diagram (NE, CCW, Convergence BG)',
27    # Save the plot (adjust path relative to this file)
28    savefig="images/gallery_taylor_diagram_in_ne_ccw_conv.png"
29)
30plt.close()
Taylor Diagram NE Orientation Convergence BG Example

🧠 Analysis and Interpretation Note

Compare this plot’s orientation to previous examples. Here, the point of perfect correlation (1.0) is at the top-right (45 degrees). The angles increase counter-clockwise, so points further “left” along the arc have lower correlation. The background color intensity directly reflects the correlation value based on the ‘Purples’ map.


Taylor Diagram (SW Orientation, Performance BG)¶

This variant uses plot_taylor_diagram_in() with perfect correlation (1.0) placed in the South-West (‘SW’) quadrant, counter-clockwise angle increase (direction=1), and the ‘performance’ background strategy. The ‘performance’ strategy uses an exponential decay centered on the best performing model in the input (closest correlation and std dev to reference), highlighting the region around it. Uses ‘gouraud’ shading for a smoother background and hides the colorbar.

 1import kdiagram.plot.evaluation as kde
 2import numpy as np
 3import matplotlib.pyplot as plt
 4
 5# --- Data Generation (using same data as previous examples) ---
 6np.random.seed(42) # Use same seed for consistency
 7reference = np.random.normal(0, 1, 100)
 8y_preds = [
 9    reference + np.random.normal(0, 0.3, 100), # Model A (close)
10    reference * 0.9 + np.random.normal(0, 0.8, 100) # Model B (worse corr/std)
11]
12names = ['Model A', 'Model B']
13
14# --- Plotting ---
15kde.plot_taylor_diagram_in(
16    *y_preds,
17    reference=reference,
18    names=names,
19    acov='half_circle',     # 90 degree span
20    zero_location='SW',     # Corr = 1.0 at South-West
21    direction=1,            # Angles increase counter-clockwise
22    fig_size=(8, 8),
23    cbar=False,             # Hide colorbar
24    cmap='twilight_shifted',# Use a cyclic map
25    shading='gouraud',      # Smoother shading
26    radial_strategy='performance', # Color based on best model proximity
27    title='Gallery: Taylor Diagram (SW, CCW, Performance BG)',
28    # Save the plot (adjust path relative to this file)
29    savefig="images/gallery_taylor_diagram_in_sw_ccw_perf.png"
30)
31plt.close()
Taylor Diagram SW Orientation Performance BG Example

🧠 Analysis and Interpretation Note

Notice the different orientation with Corr=1.0 now at the bottom-left. The ‘performance’ background strategy creates a “hotspot” (brighter color with this cmap) centered around the best input model (Model A in this case), visually guiding the eye to the top performer relative to the provided dataset. ‘gouraud’ shading smooths the background colors.

Next
Model Comparison Gallery
Previous
Uncertainty Visualizations
Copyright © 2025, Laurent Kouadio
Made with Sphinx and @pradyunsg's Furo
On this page
  • Model Evaluation Gallery (Taylor Diagrams)
    • Taylor Diagram (Flexible Input & Background)
    • Taylor Diagram (Background Shading Focus)
    • Taylor Diagram (Basic Plot)
    • Taylor Diagram (NE Orientation, Convergence BG)
    • Taylor Diagram (SW Orientation, Performance BG)