我想用两个x轴绘制一个函数。一个在底部,一个在顶部。顶部只是不同的向量。如何在顶部添加第二个x轴?
X = rand(100,100);
x = linspace(1,100,100); %bottom x axis
x2 = linspace(0.1,1,100); %top x axis
y = linspace(100,200,100);
pcolor(x,y,X);
shading interp
答案 0 :(得分:1)
这可能会有所帮助,
X = rand(100,100);
x = linspace(1,100,100);
x2 = linspace(0.1,1,100);
y = linspace(100,200,100);
h2 = axes('XAxisLocation','top','XTick',linspace(0.1,1,10),'YTick',[]);
h2_pos = get(h2,'Position');
h1 = axes('XTick',linspace(1,100,10),'YTick',[],...
'Position',h2_pos);
pcolor(x,y,X,'Parent',h1);
shading interp
给出了这个,