Python-heatmap-colorbar-plot

Ich arbeite auf einem Grundstück, das aussieht wie diese so weit:

Python-heatmap-colorbar-plot

Und ich bin mit dem folgenden code:

import matplotlib.pyplot as plt
import numpy as np
column_labels = ['A','B']
row_labels = ['A','B']
data = np.random.rand(2,2)
print(type(data))
data = np.array([[1, 0.232], [0.119, 1]])
fig, ax = plt.subplots()
heatmap = ax.pcolor(data, cmap=plt.cm.Blues)

# put the major ticks at the middle of each cell
ax.set_xticks(np.arange(data.shape[0])+0.5, minor=False)
ax.set_yticks(np.arange(data.shape[1])+0.5, minor=False)

# want a more natural, table-like display
ax.invert_yaxis()
ax.xaxis.tick_top()

ax.set_xticklabels(row_labels, minor=False)
ax.set_yticklabels(column_labels, minor=False)
plt.show()

Was ich versuche zu bekommen, ist so etwas wie dieses:

Python-heatmap-colorbar-plot

Wo sehe ich die Farbe, die bar sowie den Wert der Zellen auf Ihnen. Was würde ich brauchen, um hinzuzufügen, um meinen code zu bekommen?

Dank

InformationsquelleAutor ahajib | 2016-03-31
Schreibe einen Kommentar