0

I have exported a large Matrix from Matlab to a data.dat file, which is tab delimited. I am importing this data into a iPython script to use seaborn to create a heatmap of the matrix using the following script:

import numpy as np
import seaborn as sns
import matplotlib.pylab as plt

uniform_data = np.loadtxt("data.dat", delimiter="\t")
ax = sns.heatmap(uniform_data, linewidth=0.0)
plt.show()

This code runs fine and outputs a correct heatmap. For small matrices, the output has a nice variation indicating the matrix elements:

n5_results

However, if the size of the matrix increases in size, the result seems to have a uniform colour, which indicates that the result needs to be normalised:

n8_results

which does not seem to contain any extractable information. How can I address this?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Sid
  • 266
  • 5
  • 13
  • You can `print(uniform_data.min(), uniform_data.max())` to see if those values correspond to the colorbar extremes. (I'm pretty sure they do, because that's how the seaborn code works.) – ImportanceOfBeingErnest Nov 18 '19 at 11:17
  • You can try lowering vmax to 0.3, the colors will then differ more for lower values but you will not be able to tell if a value is 0.3, 0.5, or 1.0. You can also increase the figure size to make the "heatmap pixels" larger. – Anton Nov 18 '19 at 17:33

0 Answers0