How to only show part of a plot
67 次查看(过去 30 天)
显示 更早的评论
I have a plot with an inset plot. For the inset plot I want the x-axis 'W' to show from 0 to 1, but I only want the y-axis 'tmp5' values from -0.5 to 0.5. How do I do this? Please refer to attached image file. Specifically I want the inset to clearly show that the line does not intersect the origin.
Cheers,
Alex
B_sat = 2.9901e+004;
B_gnd = 4.6750e+004;
W=0.0001:0.0001:1;%0.0001
for m=1:length(W)
Bw(m) = ((W(m)*B_sat) + ((1-W(m))*B_gnd));
end
tmp5 = (Bw - Bc);
fig=figure;
plot((ideal_int_sum - ideal_int_sum)./ideal_int_sum*100, alt,'--', (ideal_int_sum - Bavg_int_sum)./ideal_int_sum*100, alt, '-', (ideal_int_sum - Bw_int_sum)./ideal_int_sum*100, alt, '-','linewidth',5)%
hold on
plot((ideal_int_sum - Bc_int_sum)./ideal_int_sum*100, alt, '-. k', (ideal_int_sum -FRdipole_avg_t)./ideal_int_sum *100, alt, ':k','linewidth',3)%
set(gca,'layer','top','XMinorTick','on','YMinorTick','on')
set(gca,'fontsize',24, 'fontweight','bold')
hold off
xlabel('Percent difference from benchmark solution (%)','fontsize',24, 'fontweight','bold')
ylabel('Altitude (km)','fontsize',24, 'fontweight','bold');
legend('B_{IGRF}','B_{Avg}^A (w=0.5)', 'B_w (w=0.5209)', 'B_{calc} \propto FR/TEC', 'B_{Dipole}^{avg}', 'Location','northeast')
% create smaller axes in top right, and plot on it
axes('Position',[.7 .4 .2 .2])%[x-position from 0:1, y-position from 0:1, x-size from 0:1, y-size from 0:1]
box on
plot(W,tmp5)
grid on
xlabel('W');%,'fontsize',24, 'fontweight','bold');
ylabel('\Delta B');%,'fontsize',24, 'fontweight','bold');
orient(fig,'tall')
print(fig,'merged_comp_percent_difference.jpg','-djpeg')
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!