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 commentaires

Yazan
Yazan le 1 Juil 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 le 1 Juil 2021
Maybe I should only sort myColorMap in descend order...?
Yazan
Yazan le 1 Juil 2021
Modifié(e) : Yazan le 1 Juil 2021
It is pretty straightforward to invert the colormap. Just insert this in your code:
myColorMap = flipud(hsv2rgb(hsv1));
federico nutarelli
federico nutarelli le 1 Juil 2021
Thanks it works

Connectez-vous pour commenter.

Réponses (1)

Scott MacKenzie
Scott MacKenzie le 1 Juil 2021
Modifié(e) : Scott MacKenzie le 1 Juil 2021

0 votes

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

Catégories

En savoir plus sur Images dans Centre d'aide et File Exchange

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by