Advertisement

Matlab设置坐标轴穿过原点

阅读量:

Matlab绘图功能在默认设置下,其坐标轴并不会经过坐标原点;具体示例如下:

插入以下代码,使坐标轴经过原点:

复制代码
 ax1.YAxisLocation = 'origin';

    
 ax1.XAxisLocation = 'origin';
    
 %%%%%%或者
    
 set(gca,'YAxisLocation','origin');
    
 set(gca,'XAxisLocation','origin');
    
    
    
    
复制代码
 clc;

    
 clear;
    
 close all;
    
 f1 = figure(1);
    
 ax1 = axes(f1);
    
 ax1.YAxisLocation = 'origin';
    
 ax1.XAxisLocation = 'origin';
    
 axis([-4,5,-4,5]);
    
    
    
    

![](https://ad.itadn.com/c/weblog/blog-img

全部评论 (0)

还没有任何评论哟~