I am using the clabel
function to draw contour lines on a contour plot. I have the following relevant piece of code, for which I keep getting the error message: The following kwargs were not used by contour: 'linewidth'.
The current output has contours with a large line width that I would like to reduce. Why is this not working? Is there anything that looks wrong?
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.colors as colors
from matplotlib import gridspec#, ticker
X=np.loadtxt("x.txt")
Y=np.loadtxt("y.txt")
Z2=np.loadtxt("z2.txt")
extent = [X[0], X[-1], Y[0], Y[-1]]
zmin = min(np.amin(Z2))
zmax = max(np.amax(Z2))
clev = np.arange(zmin,zmax,0.0005)
cax=ax.contourf(X,Y,Z2,clev)
cax=ax.imshow(Z2, vmin = zmin, vmax = zmax, aspect='auto',
origin="lower", extent=extent, alpha=0.5)
contours = plt.contour(X, Y, Z2, 2, linewidth=0.001, colors='black')
plt.clabel(contours, inline=True, fontsize=8)