Matplotlib surface color not solid

匿名 (未验证) 提交于 2019-12-03 02:33:02

问题:

When plotting a plane in Matplotlib, I do not get a solid color. I get the following with many shades of red:

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') 

回答1:

If you do not want any shading the solution is to set shade=False:

ax.plot_surface(X,Y,Z,color='r', shade=False) 

Source: Matplotlib Documentation



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!