plotyy x axis does not match

1 Ansicht (letzte 30 Tage)
Meh
Meh am 6 Nov. 2014
Beantwortet: Matt Tearle am 6 Nov. 2014
I am using plotyy function to draw two curves, one line the other bar using
[ax]=plotyy(X1,Y1,X2,Y2,'plot','bar')
I want the bar to be upside down, I added:
set(ax(2),'ydir','rev');
I want both axes to be date axis; I added;
datetick('x')
but xticks are overlapping; and if I turn off the second one; then they are not matching at all. Can any body help me solve this problem?

Antworten (1)

Matt Tearle
Matt Tearle am 6 Nov. 2014
Try getting rid of the ticks on one x-axis (the one that hasn't been dateticked):
set(ax(2),'XTick',[])
You may also want to ensure that the limits are the same:
xl = get(ax(1),'XLim');
set(ax(2),'XLim',xl)
(I'm not sure which is axis 1 and 2, so you may need to switch them.)

Kategorien

Mehr zu Two y-axis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by