필터 지우기
필터 지우기

Different Scales on same plot

조회 수: 2 (최근 30일)
Dhirendu Somani
Dhirendu Somani 2020년 8월 5일
댓글: Sudheer Bhimireddy 2020년 8월 5일
Attached is the image of a plot I'm willing to generate.
How to show different X Y-axis scales locally to a same plot as shown in figure.
Thank you in advance.

채택된 답변

Sudheer Bhimireddy
Sudheer Bhimireddy 2020년 8월 5일
May be give this a try:
z=1:2:100;
y=log(z); % Dummy log profile
h=figure(1);
h.Color=[1 1 1];
subplot(1,5,1)
p1=plot(y,z,'k-o');hold on;
text(-0.5,-5,'0.125'); % This is displayed near the origin
ax1 = gca;box off;
ax1.Position=[0.1 0.2 0.1 0.5];
ax1.XTick=[];ax1.YTick=[]; % Dont label anything
subplot(1,5,2)
p2=plot(y.^0.7,z,'k-o');
hold on;
text(-0.5,-5,'0.250');
ax2 = gca;box off;
ax2.Position=[0.275 0.17 0.1 0.5];
ax2.XTick=[];ax2.YTick=[];
subplot(1,5,3)
p3=plot(-2+y.^1.7,z,'k-o');
hold on;
text(-0.5,-5,'0.375');
ax3 = gca;box off;
ax3.Position=[0.45 0.15 0.1 0.5];
ax3.XTick=[];ax3.YTick=[];
ax3.YAxisLocation='Origin'; %When the x values are -ve this would move the y-axis to x=0
subplot(1,5,4)
p4=plot(-1+y.^0.6,z,'k-o');
hold on;
text(-0.5,-5,'0.500');
ax4 = gca;box off;
ax4.Position=[0.65 0.1 0.1 0.5];
ax4.XTick=[];ax4.YTick=[];ax4.YAxisLocation='Origin';
subplot(1,5,5)
p5=plot(y(1:5),z(1:5),'w');
ax5 = gca;box off;
ax5.Position=[0.74 0.85 0.1 0.1];
xlabel('m/sec');ylabel('cm');
You would have to adjust the number of subplots and axis locations as per your requirement. Another way to control the location is to change the 'Position' property of the subplot itselft. That way you can have subplots without overlapping.
Hope this helps.
  댓글 수: 2
Dhirendu Somani
Dhirendu Somani 2020년 8월 5일
Thanks a Lot
Sudheer Bhimireddy
Sudheer Bhimireddy 2020년 8월 5일
My pleasure. If you feel you got the answer, please Accept the provided solution as Answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by