How to change the colormap direction

8 visualizaciones (últimos 30 días)
Lee
Lee el 4 de Nov. de 2016
Comentada: Lee el 4 de Nov. de 2016
Hey everyone,
I have a subplot using this code. How can i change the colormap to instead show increasing "reds" (of the summer colormap) in the y direction instead of the x direction?
if true
% C = subplot(2,1,1);
plot(p2.t,p2.data,'b');hold on
scatter(p2.t,p2.data,sz,c,'filled','d');
B = scatter(DSA.Peak1Theory, DSA.Peak1DataA,'m');
A = scatter(DSA.Peak1DataF, DSA.Peak1DataA,'r');
legend([B,A],build1b,build1a)
colormap(C,summer)
title('DSA Spectra PS Oscillator');xlabel('Frequency (Hz)');ylabel('Amplitude (db*Vrms)');
hold off
end

Respuesta aceptada

Image Analyst
Image Analyst el 4 de Nov. de 2016
Show a screenshot, because I don't know what you mean by you want the colormap to go in the x direction instead of the y direction. In fact, it doesn't go in any direction. Perhaps you were referring to the colorbar, but that goes in the y direction already, so that can't be what you were referring to.
Just throwing out a wild guess, maybe you want flipud:
imshow(grayImage);
colormap(gca, flipud(summer(256)));
colorbar;
or another wild guess, just pass the color you want for every marker into scatter(). You can do that you know.
  2 comentarios
Lee
Lee el 4 de Nov. de 2016
Editada: Lee el 4 de Nov. de 2016
I accidentally pressed select this answer... but I think flipud might do it. here's the image. So instead oft he colors getting "lighter" at from 0 to x, i want the colors to get lighter from 0 to y
Lee
Lee el 4 de Nov. de 2016
flipud did not do it

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by