Effacer les filtres
Effacer les filtres

How to change the colormap direction

5 vues (au cours des 30 derniers jours)
Lee
Lee le 4 Nov 2016
Commenté : Lee le 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

Réponse acceptée

Image Analyst
Image Analyst le 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 commentaires
Lee
Lee le 4 Nov 2016
Modifié(e) : Lee le 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 le 4 Nov 2016
flipud did not do it

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Colormaps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by