Basic question about coloring of a 3d plot
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have the following question:
I have a 3D plot which shows the dependencies of 3 variables. One of these variables is the wavelength of light. Is it possible to have one specified color for each wavelength along the wavelength axis of my plot?
For example: if the wavelength equals 530 nm, then I would want the plot to be green for all points where wavelength = 530nm.
I am looking forward to, and appreciate your answers!
Kind regards, Marc
0 件のコメント
回答 (2 件)
Kelly Kearney
2013 年 7 月 5 日
Some more details about your plot would help... are you plotting points? Lines? Surfaces? A scatter plot could help with points; a patch with facecolor and/or edgecolor set to interp could help with lines or surfaces.
2 件のコメント
Kelly Kearney
2013 年 7 月 5 日
It would be helpful if you could comment on a specific answer rather than adding a new answer yourself. But in response to your clarification...
The fourth input to mesh specifies the color to plot the surface. For example, the following colors the mesh according to the x-coordinate, which I'm assuming represents wavelength:
z = peaks;
[x,y] = meshgrid(linspace(400,750,49), 1:49);
mesh(x,y,z,x);
colorbar;
Getting your colormap to reflect the visible spectrum is a little trickier using Matlab's native colormaps. Using one of my own functions (available here) along with this color palette table will accomplish it pretty easily though:
cptcmap('visspec', 'mapping', 'direct');
参考
カテゴリ
Help Center および File Exchange で Blue についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!