I tried the first script you told me but I want to reverse the colors. Bleu for negative anamoly values and red for positive. How can I do that? Also for precipitation I want colors from brown (negative) to green (positive)
Customize color map for temperature and precipitation
57 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Gulraiz Safdar
am 20 Mär. 2020
Kommentiert: Cris LaPierre
am 21 Mär. 2020
Hi I tried to plot a map using (pcolorm) and by default it get those colors :
My teacher want me to create only a small number of color bins . For temperature from red to blue and for precipitation from brown to green. Like the figure below:
Can someone help me create those colors bins?
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Cris LaPierre
am 21 Mär. 2020
Do you have to exactly reproduce the results or just something similar?
If you notice, the colorbars in the desired output do not smoothly transition from color to color. This is achieved by defining a custom colormap. One way to do this is to extract the desired number of levels from a predefined colormap.
colorMap = hsv(14);
colormap(colorMap);
If there are specific colors you want and the above technique doesn't work, then you can manually define the colors (rgb)
colorMap = [0 0 0; 0 0 1; 0 1 0; 0 1 1; 1 0 0; 1 0 1; 1 1 0; 1 1 1];
colormap(colorMap);
Applying a colormap will still try to fit the full range of values. If you want to restrict them to a specific range, use the caxis function.
caxis([-5,5])
2 Kommentare
Cris LaPierre
am 21 Mär. 2020
EDIT: Moving reply from Gulraiz Safdar here
I tried the first script you told me but I want to reverse the colors. Bleu for negative anamoly values and red for positive. How can I do that? Also for precipitation I want colors from brown (negative) to green (positive)
Cris LaPierre
am 21 Mär. 2020
Select a colormap that has blue on the left and red on the right.
It looks like jet might work. Update the code to use jet instead of hsv.
Siehe auch
Kategorien
Mehr zu Orange 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!