How to make 2D rainbow ?

4 visualizaciones (últimos 30 días)
Ole
Ole el 10 de Oct. de 2017
Comentada: Rik el 10 de Oct. de 2017
How to make a 2D rainbow plot like
https://en.wikipedia.org/wiki/Visible_spectrum#/media/File:Spectrum.svg https://en.wikipedia.org/wiki/Visible_spectrum#/media/File:Spectrum.svg
This will make 1D line.
x=1:10; y = [2 2 2 2 2 2 2 2 2 2];length = size(x, 2);
d = length:-1:1;
p = patch([x ],[y ], [d ], 'EdgeColor', 'interp');
axis off
How to add the second dimension?
  1 comentario
Rik
Rik el 10 de Oct. de 2017
Have a look at the doc for patch. If your code works (which depends on the colormap), it will most likely work for the FaceColor property.

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 10 de Oct. de 2017
x=1:10; y = [2 2 2 2 2 2 2 2 2 2];length = size(x, 2);
d = length:-1:1;
p = patch([x ],[y ], [d ], 'EdgeColor', 'interp','Linewidth',20);

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by