小编bsf*_*f10的帖子

Python Matplotlib:更改颜色条刻度宽度

我正在尝试编辑颜色栏中显示的线宽,与我在 Matplotlib 中绘制的轮廓的线宽分开。我想将轮廓线宽度设置为 0.5,但是当我这样做时,我看不到颜色栏中的颜色轮廓。如果我将轮廓线宽设置为 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, …
Run Code Online (Sandbox Code Playgroud)

python matplotlib colorbar

5
推荐指数
1
解决办法
5147
查看次数

标签 统计

colorbar ×1

matplotlib ×1

python ×1