I have the following data sets to plot:
data1 = [ 3 6 99 4 5];
data2 = [ 0.2 1.5 1.75 1.0 1.2];
What's peculiar about my situation is that I need data point data1(3)
, which is equal to 99
, not show up on the graph. I'm using 99 as a way of pushing observations outside the desired axis limits so that there are no visible observations for certain values of the independent variable. (I'm plotting the data points with markers only, no lines.)
While data1
and data2
have totally unrelated scales and meanings, they share the exact same dependent variable:
X=40:1:44
I'm plotting with the following commands, which I derived from the MATLAB plotyy documentation page:
[AX,H1,H2] = plotyy(X,data1,X,data2);
set(get(AX(1),'Ylabel'),'String','This is vertical axis 1')
set(get(AX(2),'Ylabel'),'String','This is vertical axis 2')
set(H1,'LineStyle','none','Marker','*');
set(H2,'LineStyle','none','Marker','s');
So far, so good. What I cannot figure out is how to enforce the correct limits on both of the vertical axes. My desired limits are:
ylimits1=[0 3]
ylimits2=[0 10]
How can I set limits for each vertical axis?
I have tried this
set(get(AX(1),'Ylim'),ylimits1)
set(get(AX(2),'Ylim'),ylimits2)
and
foo = gca
set(foo(1),'ylim',ylimits1);
set(foo(2),'ylim',ylimits2);
but neither work.