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 件のコメント

Yazan
Yazan 2021 年 7 月 1 日
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?
federico nutarelli
federico nutarelli 2021 年 7 月 1 日
@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 2021 年 7 月 1 日
Maybe I should only sort myColorMap in descend order...?
Yazan
Yazan 2021 年 7 月 1 日
編集済み: Yazan 2021 年 7 月 1 日
It is pretty straightforward to invert the colormap. Just insert this in your code:
myColorMap = flipud(hsv2rgb(hsv1));
federico nutarelli
federico nutarelli 2021 年 7 月 1 日
Thanks it works

サインインしてコメントする。

回答 (1 件)

Scott MacKenzie
Scott MacKenzie 2021 年 7 月 1 日
編集済み: Scott MacKenzie 2021 年 7 月 1 日

0 投票

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

カテゴリ

製品

リリース

R2020b

質問済み:

2021 年 7 月 1 日

編集済み:

2021 年 7 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by