|
Thanks to everyone, I understood the plotyy function:
xmin=-6
xmax=6
x=xmin:0.1:xmax;
y1=1./(1+exp(-x)); % sigmoid function (blue solid line)
y2=y1; % green dashed line
[ax,h1,h2]=plotyy(x,y1,x,y2)
set(ax(2),'YDir','reverse') % change the direction of the right-y axe
set(h2,'LineStyle',':') % change the style of the second curve
set(ax(1),'xlim',[xmin xmax]) % change x-axes limits of the first plot
set(ax(2),'xlim',[xmin xmax]) % change x-axes limits of the second plot
% It is a trick to avoid the overlapping of the two tick labels, ax(1) and ax(2).
set(ax(1), 'YColor', [0 0 0]) % change color (black) of the right-y axe
set(ax(2), 'YColor', [0 0 0]) % change color (black) of the left-y axe
I hope it can help.
"Paul Mennen" <nospam@mennen.org> wrote in message <hkdt2h$8nj$1@fred.mathworks.com>...
> >> "Jose " wrote
> >> I want to plot two curves in the same figure, with two different axes y
>
> "ade77 " wrote
> > doc plotyy
>
> Many people find the plotyy documentation terse and difficult to understand if you aren't a handle graphics expert. An alternative called plt.m available on the file exchange is more flexible and has a logical well documented parameter structure that doesn't require expertise in the arcane syntax of matlab handle graphics. Running it's demo (demoplt.m) should be sufficient to determine if this function will be to your liking.
>
> ~Paul
|