Filter löschen
Filter löschen

How to change the colormap direction

5 Ansichten (letzte 30 Tage)
Lee
Lee am 4 Nov. 2016
Kommentiert: Lee am 4 Nov. 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

Akzeptierte Antwort

Image Analyst
Image Analyst am 4 Nov. 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 Kommentare
Lee
Lee am 4 Nov. 2016
Bearbeitet: Lee am 4 Nov. 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 am 4 Nov. 2016
flipud did not do it

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by