横坐标轴移动位置

% for Q1:横坐标轴可否移动位置
clc;clear;close all;
t=linspace(0,8,100);
a1=axes;
plot(t,sin(t));
xt=get(gca,'xtick');
set(gca,'XTick',[],'XColor','w');
xL=xlim;
p=get(gca,'Position');
box off;
a2=axes('Position',p+[0,p(4)/2,0,-p(4)/2]);
xlim(xL);box off;
set(gca,'XTick',xt,'Color','None','YTick',[]);

% for Q2:坐标轴用两条直线来表示
figure;
axes;
% statement
set(gca,'XTick',[],'YTick',[],'Box','off');
a2=axes('Position',p+[0,p(4)/2,0,-p(4)/2]);
xlim(xL);box off;
set(gca,'XTick',xt,'Color','None','YTick',[]);

% for Q2:坐标轴用两条直线来表示
figure;
axes;
% statement
set(gca,'XTick',[],'YTick',[],'Box','off');
set(gcf,'color','w');

原文地址:https://www.cnblogs.com/einyboy/p/2868773.html