using plotyy for multiple plots
조회 수: 2 (최근 30일)
이전 댓글 표시
I have four plots, to be plotted in the same figure. Two plots are for a y-axis on the right hand side and two for the left hand side. for each pair, the x values are different. For example:
% Two plots for y at right axis
x1 = 0:10;
x2 = 0:5;
y1 = rand(1,11);
y2 = rand(1,6);
% Two plots for y at left axis
x3 = 0:10;
x4 = 0:5;
y3 = rand(1,11);
y4 = rand(1,6);
How can I plot them in a same figure with plotyy or any other command?
Thanks, :)
Soroush
댓글 수: 0
답변 (1개)
Walter Roberson
2015년 7월 16일
ax = plotyy(x3, y3, x1, y1); %left then right
line(ax(1), x4, y4); %add another line to left axis
line(ax(2), x2, y2); %add another line to right axis
댓글 수: 2
Walter Roberson
2015년 7월 16일
ax = plotyy(x3, y3, x1, y1); %left then right
line(x4, y4, 'Parent', ax(1)); %add another line to left axis
line(x2, y2, 'Parent', ax(2)); %add another line to right axis
참고 항목
카테고리
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!