How to change the colormap direction
8 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Image Analyst
on 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.
More Answers (0)
See Also
Categories
Find more on Colormaps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!