Basic question about coloring of a 3d plot
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (2)
Kelly Kearney
il 5 Lug 2013
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 Commenti
Kelly Kearney
il 5 Lug 2013
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');
Vedere anche
Categorie
Scopri di più su Blue in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!