フィルターのクリア

How to add text or annotation in matlab subplots?

4 ビュー (過去 30 日間)
shifu
shifu 2016 年 1 月 25 日
回答済み: Walter Roberson 2016 年 1 月 25 日
I have 12 scatter subplots, each for a particular year. I want to add 'year' and 'R-square value' in each subplot.
I tried 'text' but it is misplacing it. How to get it done? Here is my code,
i=1;
a=5;
step=0;
for year=2002:2013
if mod(year,4)==0
jump=366;
else
jump=365;
end
subplot(4,3,i)
scatter(data_final(step+1:step+jump,11), data_final(step+1:step+jump,12),...
a, 'filled', 'MarkerEdgeColor','b',...
'MarkerFaceColor',[0 .7 .7],...
'LineWidth',0.5)
R=corrcoef(data_final(step+1:step+jump,11), data_final(step+1:step+jump,12));
R=R(1,2)
set(gca, 'FontName', 'Arial', 'FontSize', 12)
ylim=get(gca,'ylim');
xlim=get(gca,'xlim');
text(xlim(1),ylim(2), num2str(year));
xlabel('VAR_1')
ylabel('VAR_2')
grid on;
title(num2str(year));
i=i+1;
step=step+jump;
end

回答 (1 件)

Walter Roberson
Walter Roberson 2016 年 1 月 25 日
You should probably look at the text properties for HorizontalAlignment and VerticalAlignment

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by