matplotlib - Python - color a 3d line plot -
i have 3d line plot of solar spectrum, plotted using command,
from mpl_toolkits.mplot3d.axes3d import axes3d matplotlib.collections import polycollection, linecollection matplotlib.colors import colorconverter, listedcolormap, boundarynorm import matplotlib.cm 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') the resultant plot solid blue , takes whichever individual color give in function: plot( ).
i have been trying create color gradient along z-axis, intensity, without success.
i have around 500 test numbers, each has 744 data points.
thank help!
this wouldn't let me post images because don't have enough reputation. anyway, here's link plot using code https://plus.google.com/106871046257785761571/posts/fmysdf5waqa

using example - line colour of 3d parametric curve in python's matplotlib.pyplot - got scatter plot color gradient along z axis - here's link image of plot - https://plus.google.com/u/0/106871046257785761571/posts/shtsntgqxtw?pid=6133159284332945618&oid=106871046257785761571

i used following command:
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() i still working on getting colored line plot because have lot of points, makes scatter plot slow work with.
thank
Comments
Post a Comment