ich möchte mithilfe von matplotlib einen Scatterplot plotten. Das klappt soweit auch schon ganz gut. Momentan haben alle Punkte die gleiche Farbe. Ich möchte nun eine der vorhandenen colormaps nutzen (die RdYlGn). Allerdings hab ich keine Ahnung wie ich die einbinden kann. Hier erst mal mein Beispiel:
Code: Alles auswählen
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111)
N = len((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15))
ind = np.arange(N)
ax.scatter(ind, (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), marker = 'o', color = 'darkred')
plt.xticks(ind,(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) )
ax.set_xlabel('x-Achse')
ax.set_ylabel('Y-Achse')
ax.grid(False)
plt.show
Code: Alles auswählen
from matplotlib.pyplot import colormaps
Code: Alles auswählen
imshow ( x-Achse, cmap = cm.hot )
Ich hatte es jetzt so versucht:
Code: Alles auswählen
ax.scatter(ind, (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), marker = 'o', color = imshow((1,2,3,4,5,6,7,8,9,10,11,12,13,14,15), cmap = cm.hot))
Code: Alles auswählen
TypeError: Invalid dimensions for image data
Gruß Isa