HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/statsmodels/graphics/tests/test_correlation.py
import numpy as np
import pytest

from statsmodels.datasets import randhie
from statsmodels.graphics.correlation import plot_corr, plot_corr_grid


@pytest.mark.matplotlib
def test_plot_corr(close_figures):
    hie_data = randhie.load_pandas()
    corr_matrix = np.corrcoef(hie_data.data.values.T)

    plot_corr(corr_matrix, xnames=hie_data.names)

    plot_corr(corr_matrix, xnames=[], ynames=hie_data.names)

    plot_corr(corr_matrix, normcolor=True, title='', cmap='jet')


@pytest.mark.matplotlib
def test_plot_corr_grid(close_figures):
    hie_data = randhie.load_pandas()
    corr_matrix = np.corrcoef(hie_data.data.values.T)

    plot_corr_grid([corr_matrix] * 2, xnames=hie_data.names)

    plot_corr_grid([corr_matrix] * 5, xnames=[], ynames=hie_data.names)

    plot_corr_grid([corr_matrix] * 3, normcolor=True, titles='', cmap='jet')