Reverting the caxis index

Hi all, I have made the following image (displayed). I would like the caxi to be inverted, i.e. min = 0.4 and max = 0.1. So the axis should be something like:
0.1
0.15
0.2
0.25
0.3
0.35
0.4
Ideally the code should look as follows:
caxis('manual')
caxis([round(max(auc_weighted.AUC_weighted_new),1) round(min(auc_weighted.AUC_weighted_new),1)])
Is it possible to do so?
I thought about reverting the sign but then I would like the minus sign not to display in the image...
Thank you,
Federico

5 comentarios

Yazan
Yazan el 1 de Jul. de 2021
No. Read here. The limits should specified as a vector of the form [cmin cmax], where cmin must be less than cmax.
Why don't you invert the colormap itself?
@Yazan thank you for the reply. Actually because I would like the darkest countries to have the lower values. In any case I will post the code that I produce so far below. Can you help me ut reverting the color map please (so that lighter shades are for higher indices):
%blue countries
h=.6.*ones(119,1);
v= ones(119,1);
s=[0:0.008405:1]';
hsv1 = [h,s,v];
myColorMap = hsv2rgb(hsv1);
caxis('manual')
caxis([round(min(auc_weighted.minus),1) round(max(auc_weighted.minus),1)])
%caxis([round(min(auc_weighted.AUC_weighted_new),1) round(max(auc_weighted.AUC_weighted_new),1)])
colormap(myColorMap);
colorbar
borders('countries','r')
borders('countries','facecolor',[0.85,0.85,0.85])
axis tight
for k=1:(size(auc_weighted,1))
borders(cell2mat(auc_weighted.country(k)),'facecolor',myColorMap(k,:))
end
federico nutarelli
federico nutarelli el 1 de Jul. de 2021
Maybe I should only sort myColorMap in descend order...?
Yazan
Yazan el 1 de Jul. de 2021
Editada: Yazan el 1 de Jul. de 2021
It is pretty straightforward to invert the colormap. Just insert this in your code:
myColorMap = flipud(hsv2rgb(hsv1));
federico nutarelli
federico nutarelli el 1 de Jul. de 2021
Thanks it works

Iniciar sesión para comentar.

Respuestas (1)

Scott MacKenzie
Scott MacKenzie el 1 de Jul. de 2021
Editada: Scott MacKenzie el 1 de Jul. de 2021

0 votos

To reverse the order of colors, just change
colormap(myColorMap);
to
colormap(flipud(myColorMap));

Categorías

Productos

Versión

R2020b

Etiquetas

Preguntada:

el 1 de Jul. de 2021

Editada:

el 1 de Jul. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by