我试图根据z值为线框图着色.我在互联网上找不到任何代码示例.
下面是一个表面图的示例,其中包含我想要的颜色和线框图,我无法在线上获取颜色:
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
# some numbers for the data
P=12000 #W
Q=1 #kg/s
DT=3 #K
cp=4169.32 #J/kgK
dDT=np.logspace(-2,0,20,endpoint=True)
dQ=Q*np.logspace(-3,-1,20,endpoint=True)
# the plotting data
m1,m2=np.meshgrid(dDT,dQ)
err=cp*np.sqrt((m1*Q)**2+(m2*DT)**2)/P
# the wiremesh plot that i need fixed
fig=plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_wireframe(m1, m2, err, color=err/err.max(),cmap='jet')
ax.set_xlabel('dDT')
ax.set_ylabel('DQ')
ax.set_zlabel('relative error')
# the surface plot that has the colors i want
fig = plt.figure()
ax = fig.gca(projection='3d')
surf = ax.plot_surface(m1, …
Run Code Online (Sandbox Code Playgroud) 我在matlab中生成了以下表面图:
我需要在.NET中创建它.我希望使用IronPython来做到这一点.但首先我只想尝试用Python创建绘图(PyLab).这是我到目前为止:
请看看我的代码并告诉我如何让python显示黑色边缘线.当我添加facecolors=UWR(heatmap)
属性时,它们似乎消失了surf(...)
.这是mplot3d中的错误还是设计?无论哪种方式,我如何让线路回来?
这是我的代码(大数据矩阵的道歉):
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib.pyplot as plt
import matplotlib
from pylab import *
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
#Sample colour data
heatmap = np.array([(0.304, 0.288, 0.284, 0.26, 0.248, 0.224, 0.204, 0.184, 0.18, 0.18, 0.156, 0.148, 0.144, 0.136, 0.136, 0.128, 0.124, 0.124, 0.128, 0.124, 0.124),
(0.356, 0.348, 0.332, 0.328, 0.308, 0.292, 0.288, 0.272, 0.252, 0.232, 0.216, 0.204, 0.16, …
Run Code Online (Sandbox Code Playgroud)