0
Ich habe versucht, eine Heatmap mit Matplotlib ähnlich der heatmap of plotly zu plotten. Ich bin in der Lage, die Ausgabe von der Größe der matshow Figur ist sehr klein. Hier finden Sie die Abbildung Python: Ändern der Größe von ax.matshow in Matplotlib
Ist es möglich, die folgende Abbildung zu erhalten:
Das folgende ist mein Code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
z = []
for _ in range(7):
new_row = []
for __ in range(180):
new_row.append(np.random.poisson())
z.append(list(new_row))
df1 = pd.DataFrame(np.array(z), columns=range(len(z[0])))
fig = plt.figure(figsize=(20,10))
ax = fig.add_subplot(111)
cax = ax.matshow(df1, interpolation='nearest', cmap='coolwarm')
fig.colorbar(cax)
ax.set_xticklabels([''] + list(df1.columns))
ax.set_yticklabels([''] + list(df1.index))
plt.show()
Bitte helfen.
Vielen Dank. Es funktionierte. – Jeril