1

我有一个太阳光谱的 3d 线图,我使用命令绘制,

from mpl_toolkits.mplot3d.axes3d import Axes3D
from matplotlib.collections import PolyCollection, LineCollection
from matplotlib.colors import colorConverter, ListedColormap, BoundaryNorm
import matplotlib.cm as cm

fig = plt.figure(figsize(15, 8))
ax = fig.gca(projection='3d')

x = SpectrumDF['Wavelength']
z = SpectrumDF['DNI']
y = SpectrumDF['TESTNUM']

ax.plot(x, y, z)
ax.set_xlabel('Wavelength')
ax.set_ylabel('Test Number')
ax.set_zlabel('Intensity')

结果图是纯蓝色,并采用我在函数中给出的任何一种颜色:plot()。

我一直在尝试沿 z 轴强度创建颜色渐变,但没有成功。

我有大约 500 个测试编号,每个都有 744 个数据点。

感谢您的帮助!

这不会让我发布图片,因为我没有足够的声誉。无论如何,这是我使用此代码获得的情节的链接https://plus.google.com/106871046257785761571/posts/fMYsDF5wAQa

在此处输入图像描述

4

1 回答 1

1

使用示例 - python 的 matplotlib.pyplot 中 3D 参数曲线的线条颜色- 我得到了一个沿 z 轴颜色渐变的散点图 - 这是该图图像的链接 - https://plus.google.com/u /0/106871046257785761571/posts/SHTsntgQxTw?pid=6133159284332945618&oid=106871046257785761571

在此处输入图像描述

我使用了以下命令:

fig = plt.figure(figsize(15,8))
ax = fig.gca(projection='3d')

x = FilteredDF['Wavelength']
z = FilteredDF['DNI']
y = FilteredDF['TESTNUM']

ax.scatter(x, y, z, c=plt.cm.jet(z/max(z)))

ax.set_xlabel('Wavelength')
ax.set_ylabel('Test Number')
ax.set_zlabel('Intensity')

plt.show()

我仍在努力获得彩色线图,因为我有很多点,这使得散点图的使用速度非常慢。

谢谢

于 2015-04-02T15:21:19.863 回答