How to modify the coordinate axis dimension after matlab drawing?

Time:2022-1-14

After the MATLAB drawing is completed, the coordinate axis annotation may not be what we need, and it may need to be programmed to modify the coordinate axis annotation, which can be modified by using the command.

Software name:
Mathematical software MATLAB r2016a 64 bit full Special Edition (with crack file + key + installation tutorial)
Software size:
7.6GB
Update time:
2016-11-23Download now

1. First, make an automatically generated graph;plot(randn(100,1));

You can see that the coordinate axis in the drawing has been automatically generated.

2. Use the axis command to modify the range of the axis. For example:axis([0 50 -1 1]);

You can see that the coordinate axis has changed by itself. How to modify it?

3. There are two values involved,GCF and GCA;It should be noted here that GCF represents the whole graph, including the toolbar above;GCA only represents the coordinate axis and internal data.

set(gca,’Xtick’,[0 20 40],’Ytick’,[-0.25 0.25],’fontsize’,20);

After modifying the annotation, the font size is also modified.

4. Of course, you can also modify the label words:set(gca,’Xticklabel’,{‘xx’,’yy’,’zz’},’Yticklabel’,{‘aa’,’bb’});

It should be noted that,The label should correspond to the quantity on it one by one.

5. You can also change the font and font orientation.set(gca,’XTickLabelRotation’,45);

6. In addition to modifying with commands, you can also modify manually. Enter“Displays drawing tools and docked drawings”After the interface, select the coordinate axis andThere are scale attributes in the properties of the axis, it can be modified as required.

Relevant recommendations:

How to write 3D sphere spin program in MATLAB?

How does matlab 2016 draw 3D contour graphics?

How to choose the type and color of lines drawn by MATLAB?