2nd x-axis on plotyy

Hey guys, I've got a bit of a pain of a problem I've been fighting with. I have a plotyy using 2 lots of data with the same logorithmic x-axis. I need to add a 2nd x-axis on top, but this will just be a different form of the original x-axis, i.e. if the lower x-axis was 0-10, the upper axis will be 0-100, where 1 in the lower axis = 10 in the upper.
Here's the code I have used for the plotyy:
MATLAB code
figure
[AX,H1,H2] = plotyy(x,y1,x,y2);
set(AX,'XScale','log');
set(get(AX(1),'Ylabel'),'String','Y1');
set(get(AX(2),'Ylabel'),'String','Y2');
set(H1,'LineStyle','-','Marker','x','Color','b');
set(H2,'LineStyle','--','Marker','+','Color','g');
grid on
thanks a lot Jay

回答(2 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-3-19
编辑:Azzi Abdelmalek 2013-3-19
set(AX(2),'XaxisLocation','top','xlim',[0 100])
Jay Keeley
Jay Keeley 2013-3-19
编辑:Jay Keeley 2013-3-19

0 个投票

cheers Azzi! that's great
not to be a pain but is there any way to remove the gradient marks caused by the lower axis on the upper axis? I get 2 lots of lines from the bottom and top axis. I've attached an image below. http://imgur.com/UPw9dLx.jpg
update just found that these are called xtick in matlab, but I want to just remove the ones from the lower axis, projected to the upper axis, keeping them on the lower axis.
update solved it with
set(AX(1),'Box','off');

2 个评论

can you post your code, I do not know how did you get that.
solved it mate, thanks a lot

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Two y-axis 的更多信息

产品

标签

提问:

2013-3-19

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by