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 using hierarchical clustering performed in your browser. 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). Try this: Change the clustering linkage method (Ward/Average/Single/Complete) to see different groupings, or select a subset of variables to see how the dendrogram updates dynamically.



Data: financial_corr_data




Example 2: Sales Performance Metrics

Examine correlations between sales KPIs using average linkage clustering.

Features:




Sales Performance Metrics Correlation

Explore how different sales and operational metrics relate to each other. The dendrogram reveals which metrics cluster together using hierarchical clustering performed in your browser. For example, you might see that customer satisfaction groups with response time, while revenue metrics cluster separately. Try this: Change the clustering linkage method to Average or Single to see how it compares to Ward linkage.



Data: sales_corr_data




Example 3: Scientific Measurements - Single Linkage Clustering

This example demonstrates single linkage clustering (nearest neighbor).

Features:




Scientific Measurements Correlation

This correlation plot reveals clusters of related physical, thermal, chemical, and spectroscopic properties. The hierarchical clustering 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. Try this: Switch to Single linkage to see elongated clusters formed by merging based on nearest neighbors, or try Complete linkage for more compact clusters.



Data: science_corr_data




Example 4: Healthcare Patient Metrics - Complete Linkage

Analyze correlations between patient health indicators using complete linkage clustering.

This example includes:




Patient Health Metrics Correlation

This correlation analysis helps identify relationships between vital signs, lab results, and cardiovascular risk. The hierarchical clustering 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. Try this: Switch to Complete linkage clustering (farthest neighbor) to see compact, well-separated clusters.



Data: patient_corr_data




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 using the scenario selector to see different correlation patterns. The dendrogram updates automatically showing how indicators cluster in each region. 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. Try this: Change the linkage method to see how clustering patterns differ.



Data: econ_adv_data




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 using the scenario selector to see seasonal patterns. The dendrogram updates dynamically showing how variables cluster in each season. 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.).



Data: climate_adv_data




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. Prepare correlation data for CorrPlot
corr_data = prepare_corrplot_data(cors.pearson, cors.spearman, string.(vars))

# 3. Create correlation plot (clustering happens in browser!)
corrplot = CorrPlot(:my_corr, corr_data, :my_data;
                    title="My Correlation Analysis",
                    notes="Description...")

Advanced Workflow with Multiple Scenarios (Examples 5-7)


# 1. Compute correlations for each scenario
cors1 = compute_correlations(df1, vars)
corr_data1 = prepare_corrplot_data(cors1.pearson, cors1.spearman, labels, scenario="Short-term")

cors2 = compute_correlations(df2, vars)
corr_data2 = prepare_corrplot_data(cors2.pearson, cors2.spearman, labels, scenario="Long-term")

cors3 = compute_correlations(df3, vars)
corr_data3 = prepare_corrplot_data(cors3.pearson, cors3.spearman, labels, scenario="Volatility")

# 2. Combine scenarios
all_corr_data = vcat(corr_data1, corr_data2, corr_data3)

# 3. Create CorrPlot with scenario selector
corrplot = CorrPlot(:advanced, all_corr_data, :adv_data;
                    scenario_col=:scenario,
                    title="Advanced Analysis",
                    default_scenario="Short-term",
                    default_variables=["var1", "var2", "var3"],
                    allow_manual_order=true)

Interactive Features

Linkage Methods

Use Cases

Interpretation Tips


This page was created using JSPlots.jl v0.4.0.