
Different Scales on same plot
5 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
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 件のコメント
Sudheer Bhimireddy
2020 年 8 月 5 日
My pleasure. If you feel you got the answer, please Accept the provided solution as Answer.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Axis Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!