我正在尝试编辑显示在colorbar中的线宽,它与我在Matplotlib中绘制的等高线的线宽分开。我想将轮廓线宽度设置为0.5,但当我这样做时,我无法在colorbar中看到颜色轮廓。如果我将轮廓线宽度设置为1.5,我可以在颜色栏中看到它们,但是轮廓太厚了。
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import numpy as np
#get data
delta = 0.025
x = np.arange(-3.0, 3.0, delta)
y = np.arange(-3.0, 3.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1)
Z = 10.0 * (Z2 - Z1)
#get contour levels
levels=[-1.5,-1.25,-1,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1,1.25,1.5]
fig = plt.figure()
ax = fig.add_subplot(111)
#plot contours and color bar
CS = plt.contour(X,Y,Z,levels, linestyles='solid', linewidths=0.5, exte