Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qualitative heatmap plot python

I have a matrix with sales per year for clients. Column wise I wish to have years. Line wise I wish to have companies. Color is indicative for the value (number of sales per year per client).

It is a heatmap with discrete qualitative (clients name) variable.

How could I display this ?

EDIT:

to rephrase, this is about creating an heatmap with a label per row (or a left label per cell). heatmap is plotted with pylab and gives

enter image description here

I wish to replace graduation on the left with label (discrete qualitative).

like image 371
kiriloff Avatar asked Dec 16 '22 06:12

kiriloff


1 Answers

I'm not exactly sure what you are trying to achieve, but this code

import numpy as np
import matplotlib.pyplot as plt

data = np.random.random((20, 3))

plt.imshow(data, interpolation='none', aspect=3./20)

plt.xticks(range(3), ['a', 'b', 'c'])

plt.jet()
plt.colorbar()

plt.show()

seems to produce what you want: enter image description here

like image 85
David Zwicker Avatar answered Dec 24 '22 03:12

David Zwicker