2

This is a very basic question. I could not find a satisfactory answer anywhere else so I am writing this up as a question here. I have a matrix, a square matrix about 1300 x 1300. I can use matplotlib to generate a heatmap from it. However, I want the row and column names to show up on the heat map instead of the 0 -- 1300 that normally shows up when i use imshow.

I will put up an example shortly.

Sam
  • 7,922
  • 16
  • 47
  • 62
  • Take a look at the code I posted with a question here: http://stackoverflow.com/questions/43761430/multiple-1-dimensional-heatmaps-on-single-pcolormesh-matplotlib Although my question is asking something else, I think my code snippet has exactly what you're after and can be seen in the picture in that thread. – Vlox May 03 '17 at 13:38

1 Answers1

3

You still have not put up your example, but I will give you a quick example of how to change the labels on each axis!

First, put your labels in an array, let's call them y_labels and x_labels

Now here is your code:

ax = pylab.subplots()
ax.set_yticklabels(y_labels)
ax.set_xticklabels(x_labels)

That should do the trick!

Ryan Saxe
  • 17,123
  • 23
  • 80
  • 128