pyplot 静态颜色映射
我正在使用以下代码来生成一个带有颜色图的图表:
# Create a 3d plot
fig = pyplot.figure()
ax = fig.gca(projection='3d')
# Plot the frequency-time
ax.plot_surface(X, Y, Z, rstride=4, cstride=5 + (samplerate / 20), alpha=0.3)
cset = ax.contour(X, Y, Z, zdir='y', offset=tlen, cmap=cm.coolwarm)
不过,我想用一种固定的颜色:#066。所以我不想要渐变效果。
有没有办法做到这一点呢?
问候,
Mat
1 个回答
0
如果你想使用一个固定的颜色,就不要传递 cmap
这个参数,而是用 colors
来代替:
cset = ax.contour(X, Y, Z, zdir='y', offset=tlen, colors='r')