Für meine Masterarbeit brauche ich viele schöne Konturenplots. Das klappt auch ganz gut. Nur die Achsenbeschriftung nicht. Ich möchte, dass die Zahlen an den Achsen den tatsächlichen Werten von x und y entsprechen. Ich habe es schon mit "plt.xticks(np.arange(-1, 1, 0.5))" probiert, was jedoch nicht klappt. Hier ist mein code:
Code: Alles auswählen
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
x = np.arange(-1.0,1.0,0.01)
y = np.arange(-1.0,1.0,0.01)
X,Y = np.meshgrid(x, y) # grid of point
Z=np.cos(3*X)*np.sin(3*Y)
im = plt.imshow(Z,cmap=cm.RdBu) # drawing the function with red and blue colourmap
plt.cset = plt.contour(Z,np.arange(-2.0,2.0,2.0),linewidths=2,cmap=cm.Set2)#adding the contour lines
plt.clabel(plt.cset,inline=True,fmt='%1.1f',fontsize=10)#labeling the contourlines
plt.colorbar(im)
plt.title("nice contourplot")
plt.show()
Vielen Dank für jede Hilfe!