The MATLAB documentation on plotyy states that
[ha, h1, h2] = plotyy(...)
returns the descriptors of two axes created in ha , and the descriptors of graphical objects from each graph in h1 and h2 . ha(1) is the left axis, and ha(2) is the right axis.
So, the first argument returned by plotyy is the handle to each of the created axes. To plot on the left axis, use plot(ha(1), x, y) and to plot on the right axis use plot(ha(2), x, y) .
If you don't need graphic descriptors, you can simply use ha = plotyy(...) . Otherwise, h1 and h2 returns the descriptors of the lines (or other graphic object) plotted as a result of calling plotyy . So, following the documentation example, setting line styles for two lines can be done as follows:
set(h1, 'LineStyle', '--') set(h2, 'LineStyle', ':')
Chris source share