Setting color to text from a colormap

7 ビュー (過去 30 日間)
Ahmed Abdulla
Ahmed Abdulla 2020 年 7 月 3 日
回答済み: Monisha Nalluru 2020 年 7 月 8 日
I have generated the following figure, the numbers are the correlatios from the scatter plot, i was thinking of changing the colour of the numbers to be representative of the correlation.
I used the following to display the correlations:
subplot_tight(numCols,numCols,N)%,axis square;
A=round(corr(Long_Lat_Data(:,i),Long_Lat_Data(:,j)),3); %rounding the correlation value to 3 decimal places to save space on plot
set(gca,'XTick',[])
set(gca,'YTick',[])
str = {A};
% axis([0 2 0 2])
t = text(0.2,0.5,str);
t(1).FontSize = 8;

採用された回答

Monisha Nalluru
Monisha Nalluru 2020 年 7 月 8 日
You can set the text color to RGB format by setting ‘Color’property of ‘text’ function.
You can make use of the following code to set text color to red
t = text(0.2,0.5,str);
t.Color='r';
You can refer this link to view other properties.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by