MATLAB plot Graph

Source: Internet
Author: User

When drawing with MATLAB, it is found that the line is too close within a part of the range. So I want to draw another small image in the figure to implement the local zoom-in function.

Among the many online remedies, after hard selection and tests, we found that the following methods are the most simple and effective.

Not much nonsense, 2) key code; 1) effect.

% ----- 1 effect:


Note that the position and size of a thumbnail are controlled by Code. For details, see the following code for 20 lines.

% ----- 2 code:

figureTextFontSize=20;LegendFontSize = 18;% ------------- Plot the big one : -------------set(0,'DefaultAxesFontName','Times',...    'DefaultLineLineWidth',1,...    'DefaultLineMarkerSize',8);set(gca,'FontName','Times New Roman','FontSize',TextFontSize);set(gcf,'Units','inches','Position',[0 0 6.0 4.0]);% --- 1 Avg-OPT_costs_1mplot(gamma, Avg_OPT_C, '-dk')hold on% --- 2 Avg-OPT_costs_2mplot(gamma, Avg_Greedy_C, '--sb')hold ongrid onxlabel('\gamma')ylabel('Cost')hg1 = legend('Offline OPT', 'Offline Greedy',1);set(hg1,'FontSize',LegendFontSize);% --- Plot the big one :~% ------------- Plot the small one : -------------set(0,'DefaultTextFontName','Times',...    'DefaultAxesFontName','Times',...    'DefaultLineLineWidth',1,...    'DefaultLineMarkerSize',4);h1=axes('position',[0.42 0.26 0.45 0.44]);set(h1,'FontName','Times New Roman','FontSize',16);axis(h1);xlim([0 0.25]);h41=plot(gamma2,Avg_OPT_C2,'-dk');hold onh42=plot(gamma2,Avg_Greedy_C2,'--sb');% --- Plot the small one :~


Davy_h

2014-09-13

MATLAB plot Graph

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.