statsmodels.graphics.correlation.plot_corr_grid(dcorrs, titles=None, ncols=None, normcolor=False, xnames=None, ynames=None, fig=None, cmap='RdYlBu_r')
[source]
Create a grid of correlation plots.
The individual correlation plots are assumed to all have the same variables, axis labels can be specified only once.
Parameters: |
|
---|---|
Returns: |
fig – If |
Return type: |
Matplotlib figure instance |
>>> import numpy as np >>> import matplotlib.pyplot as plt >>> import statsmodels.api as sm
In this example we just reuse the same correlation matrix several times. Of course in reality one would show a different correlation (measuring a another type of correlation, for example Pearson (linear) and Spearman, Kendall (nonlinear) correlations) for the same variables.
>>> hie_data = sm.datasets.randhie.load_pandas() >>> corr_matrix = np.corrcoef(hie_data.data.T) >>> sm.graphics.plot_corr_grid([corr_matrix] * 8, xnames=hie_data.names) >>> plt.show()
© 2009–2012 Statsmodels Developers
© 2006–2008 Scipy Developers
© 2006 Jonathan E. Taylor
Licensed under the 3-clause BSD License.
http://www.statsmodels.org/stable/generated/statsmodels.graphics.correlation.plot_corr_grid.html