Question

I have to plot my data on two y axes sharing one x axis. This can be done using plotyy. How do I overlay two patch plots such that one patch is on each y axis? As of now, both my patches are plotted on the first y-axis. How do I specify the y-axis for patch command?

Thanks

Was it helpful?

Solution

You can draw on either axis by setting the current axis property of the figure.

ax = plotyy(...);
% draw on axis 1
set(gcf, 'CurrentAxes', ax(1))
patch(x,y,c)
% draw on axis 2
set(gcf, 'CurrentAxes', ax(2))
patch(x,y,c)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top