How to make a plot with upper x-axis adapted to the scale of the lower x-axis
조회 수: 6 (최근 30일)
이전 댓글 표시
Hello, I'm trying to make a plot with two x-axex, one on the top and one on the bottom, referring to the same curve in the figure. I can make the top axis by plotting a dummy curve with no line, but of course that aligns the top axis to that curve, not to the bottom axis scale. I attach an example of the results below. The snippet of the code I am using is this:
figure(99); plot(xxp,Paux_H98tot_series,'-sk','markersize',10,'linewidth',3)
hAx(1)=gca;
hAx(2)=axes('Position',hAx(1).Position,'XAxisLocation','top','YAxisLocation','right','color','none'); hold(hAx(2),'on')
plot(hAx(2),fnGmodel_series,Paux_H98tot_series,'-ob'); set(hAx(2),'yticklabel',{});

The thin blue curve is only the dummy that allows me to create a separate x-axis on the top and it will have a "no line" so it will disappear. But of course the top axis aligns with this curve now, and it does not give the correct values for the black curve.
What I need is the top axis to align with the black curve (the only one that will remain in the final plot), so the ticks and scale should move to the right, basically.
Is there a way to make this kind of plot with the top x-axis that refers to the values of the bottom axis, moving the ticks and scales of the axis instead of the curve?
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!