How to add text or annotation in matlab subplots?
조회 수: 5 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Annotations에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!