Matlab plot drawing coordinate settings for font, font size, range, interval, etc.

Source: Internet
Author: User
Tags sin

Matlab plot drawing coordinate settings for font, font size, range, interval, etc.

The number, range, and interval adjustment of MATLAB coordinates

Matlab drawing when only the plot function out of the diagram does not necessarily conform to their most desired format, often to coordinate the number, range, interval to do processing.

Although it is not very difficult to operate, but it is often used, but also easy to forget, so put it here to illustrate:

x = (1:50);
y = sin (x);
Plot (x, y, '-r* ');
Xlabel (' x name ');% x axis name
Ylabel (' y name ');
Legend (' xxx '); % line Comment, multiple words: Legend (' xxx ', ' xxx2 ', ' xxx3 ')

Xlim ([2, 46]);% only sets the drawing range of the X-axis
Set (GCA, ' XTick ', [2:2:46])% change the x-axis coordinate interval to show that the interval is 2
The x-axis can be well controlled and the y-axis is similar.

Axis ([2,46,0,2])%axis ([Xmin,xmax,ymin,ymax]), this statement can be used to control the upper and lower bounds of the x, Y axis, but the interval is to use the above set to change

Matlab Drawing font Size control

Coordinate map has a variety of numbers and text, because the size of the graph, often will need to adjust the size of the font, here is a simple list, later thought of the addition ~

General Method:

In the finished diagram, click Edit Plot above, then click the right button where you need to change, if you need more complicated changes to double-click the picture, then find the place to change.

Setup method:

Set the number size of the axis, including the legend text size:

set (GCA, ' FontSize ', +);

Set the x-axis marker text size (Y-axis Ylabel):

xlabel (' xxxx ', ' fontsize ');%xxxx axis name

The number, range, and interval adjustment of MATLAB coordinates

Matlab drawing when only the plot function out of the diagram does not necessarily conform to their most desired format, often to coordinate the number, range, interval to do processing.

Although it is not very difficult to operate, but it is often used, but also easy to forget, so put it here to illustrate:

x = (1:50);
y = sin (x);
Plot (x, y, '-r* ');
Xlabel (' x name ');% x axis name
Ylabel (' y name ');
Legend (' xxx '); % line Comment, multiple words: Legend (' xxx ', ' xxx2 ', ' xxx3 ')

Xlim ([2, 46]);% only sets the drawing range of the X-axis
Set (GCA, ' XTick ', [2:2:46])% change the x-axis coordinate interval to show that the interval is 2
The x-axis can be well controlled and the y-axis is similar.

Axis ([2,46,0,2])%axis ([Xmin,xmax,ymin,ymax]), this statement can be used to control the upper and lower bounds of the x, Y axis, but the interval is to use the above set to change

Matlab Drawing font Size control

Coordinate map has a variety of numbers and text, because the size of the graph, often will need to adjust the size of the font, here is a simple list, later thought of the addition ~

General Method:

In the finished diagram, click Edit Plot above, then click the right button where you need to change, if you need more complicated changes to double-click the picture, then find the place to change.

Setup method:

Set the number size of the axis, including the legend text size:

set (GCA, ' FontSize ', +);

Set the x-axis marker text size (Y-axis Ylabel):

xlabel (' xxxx ', ' fontsize ');%xxxx axis name


Example:



X=0:0.2:8

Plot (X,sin (x), '-K ');

Set (GCA, ' fontname ', ' Times New Roman ', ' FontSize ', 12);

Legend (' Sinx ');

Xlabel (' x ', ' fontname ', ' Times New Roman ', ' FontSize ', 12);

Ylabel (' Y=sinx ', ' fontname ', ' Times New Roman ', ' FontSize ', 12);

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.