1

I want to create a correlation heat map that is clustered such that it looks "pretty". The heat map should have 1's on the diagonals, of course, but also the columns/rows should be ordered such that the more correlated items are grouped together. This way, there will be blocks of red (correlated items, for example) along the diagonals. Is there a way to do this in python?

user2015487
  • 2,075
  • 3
  • 17
  • 20
  • Are you trying to do multivariate kernel density estimation: http://en.wikipedia.org/wiki/Multivariate_kernel_density_estimation – Di Zou Nov 26 '14 at 18:09
  • If you are, scipy has something that you can use to generate kdes: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.gaussian_kde.html Here's another example on Stackoverflow: http://stackoverflow.com/questions/21918529/multivariate-kernel-density-estimation-in-python – Di Zou Nov 26 '14 at 18:15
  • I am not looking to do either of the two suggestions listed above but thanks. Actually what I want to do is really simple. I have 20 variables. I make a correlation heat map, in which the variables names are listed on both the x and y axis. And the values in the matrix are between -1 and 1. Similar to http://stackoverflow.com/questions/5453336/plot-correlation-matrix-into-a-graph However, in addition i want to reogranize the order in which the variables appear such that on the diagonals, i get the more correlatied items together so it looks nicer. If you don't, it's hard to draw conclusions. – user2015487 Nov 26 '14 at 19:32
  • Also, I don't require a really robust method. Even some possibly greedy method would work. – user2015487 Nov 26 '14 at 19:35
  • This might help you: http://stackoverflow.com/questions/21071128/matplotlib-plot-numpy-matrix-as-0-index – Di Zou Dec 01 '14 at 14:54

0 Answers0