Coordinate Axis number, range, and interval control for Matlab plotting.

Source: Internet
Author: User

MATLABOnly used for drawingPlotThe graph output by the function does not necessarily conform to the desired format, It is often necessary to process the number, range, and interval of the subject.

Although it is not difficult to operate, it is often used and easy to forget. So here we will describe it:

X = (1:50 );
Y = sin (X );
Plot (X, Y, '-R *');
Xlabel ('x name'); % x axis name
Ylabel ('y name ');
Legend ('xxx'); % line comment. If there are multiple lines: Legend ('xxx', 'xxx2 ', 'xxx3 ')

Xlim ([2, 46]); % only sets the drawing range of the X axis
Set (GCA, 'xtick', []) % change the X axis coordinate interval to 2
% Above, we can control the X axis very well. The Y axis is similar.

Axis ([,]) % axis ([xmin, xmax, ymin, Ymax]). You can use this statement to control the upper limit and lower limit of X and Y axes, however, the interval must be changed using the set above.

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.