Different Scales on same plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dhirendu Somani
am 5 Aug. 2020
Kommentiert: Sudheer Bhimireddy
am 5 Aug. 2020
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 Kommentare
Akzeptierte Antwort
Sudheer Bhimireddy
am 5 Aug. 2020
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 Kommentare
Sudheer Bhimireddy
am 5 Aug. 2020
My pleasure. If you feel you got the answer, please Accept the provided solution as Answer.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Axis Labels finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!