how to change things after using plotyy

8 views (last 30 days)
alex on 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-
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.

Accepted Answer

Sean de Wolski
Sean de Wolski on 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).
[AX,H1,H2]= plotyy(1:10,1:10,1:10,exp(1:10),'plot');

More Answers (0)

Community Treasure Hunt

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

Start Hunting!