Matplotlib表面颜色不牢固 [英] Matplotlib surface color not solid
本文介绍了Matplotlib表面颜色不牢固的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Matplotlib 中绘制平面时,我没有得到纯色.我得到以下带有许多红色阴影的颜色:
When plotting a plane in Matplotlib, I do not get a solid color. I get the following with many shades of red:
我在 Python 3.5.2 中使用 Matplotlib 1.5.1 版.我正在运行的代码如下:
I am using Matplotlib version 1.5.1 in Python 3.5.2. The code that I'm running is below:
import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
xaxis = np.linspace(-3, 3, 201)
yaxis = np.linspace(-3, 3, 201)
X, Y = np.meshgrid(xaxis, yaxis)
Z = 8 - 3*X - 3*Y
ax.plot_surface(X,Y,Z,color='r')
plt.savefig('not_red.png')
推荐答案
如果您不希望有任何阴影,解决方案是设置 shade = False
:
If you do not want any shading the solution is to set shade=False
:
ax.plot_surface(X,Y,Z,color='r', shade=False)
来源: Matplotlib文档
这篇关于Matplotlib表面颜色不牢固的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文