忽然笑
您可以尝试的一种可能性是创建三个轴,一个轴堆叠在另一个轴上'Color',将顶部两个轴的属性设置为,'none'以便所有图可见。您必须调整轴的宽度,位置和x轴限制,以使3个y轴并排而不是彼此重叠。您还希望从两个轴中删除x轴刻度线和标签,因为它们将彼此叠置。这是一个通用实现,可以计算轴的正确位置和x轴限制的偏移量,以使图正确对齐:%# Some sample data:x = 0:20;N = numel(x);y1 = rand(1,N);y2 = 5.*rand(1,N)+5;y3 = 50.*rand(1,N)-50;%# Some initial computations:axesPosition = [110 40 200 200]; %# Axes position, in pixelsyWidth = 30; %# y axes spacing, in pixelsxLimit = [min(x) max(x)]; %# Range of x valuesxOffset = -yWidth*diff(xLimit)/axesPosition(3);%# Create the figure and axes:figure('Units','pixels','Position',[200 200 330 260]);h1 = axes('Units','pixels','Position',axesPosition,... 'Color','w','XColor','k','YColor','r',... 'XLim',xLimit,'YLim',[0 1],'NextPlot','add');h2 = axes('Units','pixels','Position',axesPosition+yWidth.*[-1 0 1 0],... 'Color','none','XColor','k','YColor','m',... 'XLim',xLimit+[xOffset 0],'YLim',[0 10],... 'XTick',[],'XTickLabel',[],'NextPlot','add');h3 = axes('Units','pixels','Position',axesPosition+yWidth.*[-2 0 2 0],... 'Color','none','XColor','k','YColor','b',... 'XLim',xLimit+[2*xOffset 0],'YLim',[-50 50],... 'XTick',[],'XTickLabel',[],'NextPlot','add');xlabel(h1,'time');ylabel(h3,'values');%# Plot the data:plot(h1,x,y1,'r');plot(h2,x,y2,'m');plot(h3,x,y3,'b');这是结果图: