MATLAB中把画图坐标轴放置在左上角

   MATLAB中把画图坐标轴放置在左上角这个问题比较简单,直接上代码,有详尽的注解,其他不再说明。

%% 2018/02/08 by DQ
clc ;
clear;
close all;
%% 画图坐标轴放置在左下角
figure;
x=-pi:0.1:pi;
y=sin(x);
plot(x,y,'g*');%左下角

%% 画图坐标轴放置在左上角
%% 方法1 
figure;
x=-pi:0.1:pi;
y=sin(x);
plot(x,y,'rO');%右上角
axis ij

%% 方法2
figure;
x=-pi:0.1:pi;
y=sin(x);
plot(x,y,'m +');%右上角
Ax=gca;
Ax.XAxisLocation='top';
Ax.YDir='reverse';
 是的就这么简单,这是就是Matlab风格:简单,快捷。

猜你喜欢

转载自blog.csdn.net/lingyunxianhe/article/details/80383267