How can I set the x-axis in a plotyy to "datetick('x','yy') "?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi,
I'm trying to use plotyy but I need a second line on the first y-axis. I'm doing this with the "line" but this screws up the formatting of the x-axis. My code is as follows:
h = figure(3)
for s=1:6
subplot(3,2,s)
figure(h)
[ax, h1, h2] = plotyy(dates,Y1(:,s),dates,Y2(:,s));
line(dates,Y3(:,s),'parent',ax(1));
%axis tight
xlabel('Year')
datetick('x','yy')
ylabel('Index')
title(Headertext(1,s+1),'FontSize',11)
end
What I want is the x-axis to be labelled in years. But what I get is two overlapping axis. One with the right datetick format, one with just the matlab dates (format 726478 etc.)
any ideas how to get just one, correctly labelled x-axis?
I tried as well using
[ax,h1,h2]=plotyy(dates,Y1(:,s),dates,Y2(:,s));
hold on
set(ax(2),'nextplot','add');
plot(ax(2),dates,Y3(:,s))
xlabel('Year')
datetick('x','yy')
ylabel('Index')
but that didn't work either...
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Two y-axis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!