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);