Matlab绘图,编辑坐标轴,刻度朝外
1. 不显示 x 坐标轴刻度
set(gca,'xtick',[]);
2. 坐标轴的刻度朝外
set(gca,'TickDir','out')
3. 绘制单个点
x=100;
y=100;
plot(x, y, '+')
4. Y轴反向(0刻度在上,往下递增)
ax = gca; % current axes
ax.YDir = 'reverse';
5. 将X轴的标度显示在上方
ax.XAxisLocation = 'top';
6. 只在左侧,和上侧显示标度
ax.Box = 'off';
示例:
clear;
close all;
v=[3 3 6 6 5 5 7 7];
z=[0 2 2 10 10 12 12 20];
figure;
plot(v,z)
xlabel('P-VELOCITY KM/SEC');
ylabel('DEPTH IN KM');
ax = gca; % current axes
ax.YDir = 'reverse';
axis([2 9 0 20]);
ax.XTick = 2:1:9;
ax.YTick = 0:10:20
ax.XTickLabel = {'2','','4','','6','','8',''};
ax.XAxisLocation = 'top';
ax.TickDir = 'out';
ax.Box = 'off';
print('./V-Z.eps','-depsc')

7. 用matlab绘制不带白边的图
imshow(image,'border','tight')