See here for the example code that generated this page

CorrPlot (Correlation Plot with Dendrogram) Examples

This page demonstrates the interactive CorrPlot chart type in JSPlots.




Example 1: Financial Metrics Correlation Analysis

Analyze correlations between various financial metrics for companies.

This example demonstrates:




Financial Metrics Correlation Analysis

This correlation plot shows relationships between financial metrics. The dendrogram groups similar metrics based on correlation patterns. Variables are automatically reordered by clustering to reveal correlation blocks. Top-right triangle shows Pearson correlations (linear relationships), while bottom-left shows Spearman correlations (rank-based, captures non-linear monotonic relationships).




Example 2: Sales Performance Metrics

Examine correlations between sales KPIs using average linkage clustering.

Features:




Sales Performance Metrics Correlation (Average Linkage)

Explore how different sales and operational metrics relate to each other. This example uses average linkage clustering (compare to Ward linkage in Example 1). The dendrogram reveals which metrics cluster together. For example, you might see that customer satisfaction groups with response time, while revenue metrics cluster separately.




Example 3: Scientific Measurements - Single Linkage Clustering

This example demonstrates single linkage clustering (nearest neighbor).

Features:




Scientific Measurements Correlation (Single Linkage)

This correlation plot reveals clusters of related physical, thermal, chemical, and spectroscopic properties. Single linkage clustering creates elongated clusters by merging based on nearest neighbors. Notice how the dendrogram groups density-related properties together, thermal properties in another cluster, and spectroscopic measurements in a third cluster. The dual correlation display (Pearson vs Spearman) helps identify non-linear relationships.




Example 4: Healthcare Patient Metrics - Complete Linkage

Analyze correlations between patient health indicators using complete linkage clustering.

This example includes:




Patient Health Metrics Correlation (Complete Linkage)

This correlation analysis helps identify relationships between vital signs, lab results, and cardiovascular risk. Complete linkage clustering (farthest neighbor) tends to create compact, well-separated clusters. The dendrogram reveals natural groupings: blood pressure metrics cluster together, lipid panel values form another group, and glucose-related metrics cluster separately. Compare Pearson (upper right) vs Spearman (lower left) correlations to see if relationships are linear or non-linear.




Example 5: Advanced CorrPlot - Economic Indicators Across Regions

Compare economic indicator correlations across different geographic regions:

Insights to explore:




Economic Indicators - Regional Comparison

Compare how economic indicators correlate across North America, Europe, and Asia-Pacific. Switch between regions to see different correlation patterns. Select specific indicators to focus your analysis. Notice how GDP Growth correlates differently with other indicators in each region, reflecting different economic structures and policies.





Example 6: Advanced CorrPlot - Climate Variables by Season

Analyze how climate variable correlations change across seasons:

Key observations:




Climate Variable Correlations - Seasonal Analysis

Explore how climate variable correlations change across seasons. Switch between Spring, Summer, Fall, and Winter to see seasonal patterns. Notice how Temperature-Humidity correlations flip between seasons (negative in Spring/Fall, positive in Summer/Winter). Use variable selection to focus on specific climate factors. Try manual ordering to group related variables by type (temperature-related, precipitation-related, etc.).





Summary

The CorrPlot chart type provides:

Basic Workflow (Examples 1-4)


# 1. Compute correlations
vars = [:var1, :var2, :var3, :var4]
cors = compute_correlations(df, vars)

# 2. Perform hierarchical clustering
hc = cluster_from_correlation(cors.pearson, linkage=:ward)

# 3. Create correlation plot
corrplot = CorrPlot(:my_corr, cors.pearson, cors.spearman, hc,
                    string.(vars);
                    title="My Correlation Analysis",
                    notes="Description...")

Advanced Workflow with Multiple Scenarios (Examples 5-7)


# 1. Create multiple correlation scenarios
scenario1 = CorrelationScenario("Short-term", pearson1, spearman1, hc1, labels1)
scenario2 = CorrelationScenario("Long-term", pearson2, spearman2, hc2, labels2)
scenario3 = CorrelationScenario("Volatility", pearson3, spearman3, hc3, labels3)

# 2. Create advanced CorrPlot with interactive features
corrplot = CorrPlot(:advanced, [scenario1, scenario2, scenario3];
                    title="Advanced Analysis",
                    default_scenario="Short-term",
                    default_variables=["var1", "var2", "var3"],
                    allow_manual_order=true)

Advanced Features (Examples 5-7)

Linkage Methods

Use Cases

Interpretation Tips


This page was created using JSPlots.jl.