how to change things after using plotyy

3 Ansichten (letzte 30 Tage)
alex
alex am 13 Jul. 2012
after using the plotyy function with the order-
[AX,H1,H2]= plotyy(VEC,diviation,VEC,diviation_T,'plot');
I want to change a few things- 1. the tick's location in the X-axe, and the xticklabel.. the problem is that when I use the order-
set(gca,'XTickLabel',{'0-5','6-11','12-17','18-23','24-30','31-36','37-42','43-48','49-54','55-60','61-69'},'XTick',VEC,'FontWeight','bold','FontSize',20);
the graph just adds the new ticks without erasing the old ones.
2. also I can't change the linestyle- I want it to be '-s' or '-o' but I can only put '-' or ':' without getting an error notification.
3. when using the order above - set(gca,'XTickLabel',.... it changes only the x-axe and one of the y-axes, I want it to change both of the Y-axes.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 13 Jul. 2012
plotyy works by having two axes on top of each other. In your above, the output handle AX will be a 1x2 vector. When you set gca to have new XTickLabels only the current axes is updated and not both. So what you need to do is turn off the xticklabels for the first axes and set them for the second (or vice versa).
E.g:
[AX,H1,H2]= plotyy(1:10,1:10,1:10,exp(1:10),'plot');
set(AX(1),'XTickLabel',[]);
set(AX(2),'XTickLabel',{'0-5','6-11','12-17','18-23','24-30','31-36','37-42','43-48','49-54','55-60','61-69'},'XTick',1:10,'FontWeight','bold','FontSize',20);

Weitere Antworten (0)

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