1import numpy as np 2import pytest 3 4from statsmodels.datasets import randhie 5from statsmodels.graphics.correlation import plot_corr, plot_corr_grid 6 7 8@pytest.mark.matplotlib 9def test_plot_corr(close_figures): 10 hie_data = randhie.load_pandas() 11 corr_matrix = np.corrcoef(hie_data.data.values.T) 12 13 plot_corr(corr_matrix, xnames=hie_data.names) 14 15 plot_corr(corr_matrix, xnames=[], ynames=hie_data.names) 16 17 plot_corr(corr_matrix, normcolor=True, title='', cmap='jet') 18 19 20@pytest.mark.matplotlib 21def test_plot_corr_grid(close_figures): 22 hie_data = randhie.load_pandas() 23 corr_matrix = np.corrcoef(hie_data.data.values.T) 24 25 plot_corr_grid([corr_matrix] * 2, xnames=hie_data.names) 26 27 plot_corr_grid([corr_matrix] * 5, xnames=[], ynames=hie_data.names) 28 29 plot_corr_grid([corr_matrix] * 3, normcolor=True, titles='', cmap='jet') 30