Correlation heatmap
<p>I want to represent correlation matrix using a heatmap. There is something called <a href="http://www.sthda.com/english/wiki/visualize-correlation-matrix-using-correlogram" rel="nofollow">correlogram</a> in R, but I don't think there's such a thing in Python.</p>

<p>How can I do this? The values go from -1 to 1, for example:</p>

<pre><code>[[ 1.          0.00279981  0.95173379  0.02486161 -0.00324926 -0.00432099]
 [ 0.00279981  1.          0.17728303  0.64425774  0.30735071  0.37379443]
 [ 0.95173379  0.17728303  1.          0.27072266  0.02549031  0.03324756]
 [ 0.02486161  0.64425774  0.27072266  1.          0.18336236  0.18913512]
 [-0.00324926  0.30735071  0.02549031  0.18336236  1.          0.77678274]
 [-0.00432099  0.37379443  0.03324756  0.18913512  0.77678274  1.        ]]
</code></pre>

<p>I was able to produce the following heatmap based on another <a href="http://stackoverflow.com/questions/33282368/plotting-a-2d-heatmap-with-matplotlib">question</a>, but the problem is that my values get 'cut' at 0, so I would like to have a map which goes from blue(-1) to red(1), or something like that, but here values below 0 are not presented in an adequate way.</p>

<p><a href="http://i.stack.imgur.com/GSSDb.png" rel="nofollow"><img src="http://i.stack.imgur.com/GSSDb.png" alt="enter image description here"></a></p>

<p>Here's the code for that:</p>

<pre><code>plt.imshow(correlation_matrix,cmap='hot',interpolation='nearest')
</code></pre>

<ol>
<li>Use the 'jet' colormap for a transition between blue and red.</li>
<li>Use <code>pcolor()</code> with the <code>vmin</code>, <code>vmax</code> parameters.</li>
</ol>

<p>It is detailed in this answer:
<a href="http://stackoverflow.com/a/3376734/21974">http://stackoverflow.com/a/3376734/21974</a></p>

python