Prev: Reading .mfc file
Next: ROI wavelet coefficients
From: Floris Zoutman on 21 Jun 2010 05:51 I am trying to use plotyy to four series three of which have the same y-axis, the fourth has a different y-axis. So far my code looks something like this: X1=[x1 x2 x3]; Y1=[y1 y2 y3]; plotyy(X1,Y1,x4,y4) I do get a plot but I am not to satisified with the result. First, I would like to set the line type for each serie individually. For example I would like (x1,y1,'-'), (x2,y2,':') etcetera, but I do not see how I can do something like that using plotyy. Also, Matlab "chooses" to give more space to my fourth serie. That is, there is a lot of white space above my first three series. But actually, my first three series are more important than the fourth serie, so I would like the first three series to just fit in the plot while the fourth one adapts. How should I adapt my code to get the desired results? Many thanks for your help. With kind regards, Floris
From: dpb on 21 Jun 2010 07:08 Floris Zoutman wrote: > I am trying to use plotyy to four series three of which have the same > y-axis, the fourth has a different y-axis. So far my code looks > something like this: > X1=[x1 x2 x3]; > Y1=[y1 y2 y3]; > plotyy(X1,Y1,x4,y4) > > I do get a plot but I am not to satisified with the result. First, I > would like to set the line type for each serie individually. For example > I would like (x1,y1,'-'), (x2,y2,':') etcetera, but I do not see how I > can do something like that using plotyy. Also, Matlab "chooses" to give > more space to my fourth serie. That is, there is a lot of white space > above my first three series. But actually, my first three series are > more important than the fourth serie, so I would like the first three > series to just fit in the plot while the fourth one adapts. How should I > adapt my code to get the desired results? Many thanks for your help. Save the handles when do the initial plotyy call and then use get/set on those handles to modify the axes properties to suit. [ax,h1,h2] = plotyy(X1,Y1,x4,y4); %Save handles doc plotyy get(ax(1) will display all properties of the axis...in particular you're interested in the line style of the plot lines and the 'Ylim' property of the axes. doc axis % may be useful in the latter... -- --
From: Floris Zoutman on 21 Jun 2010 08:13 dpb <none(a)non.net> wrote in message <hvnhbo$6q7$1(a)news.eternal-september.org>... > Floris Zoutman wrote: > > I am trying to use plotyy to four series three of which have the same > > y-axis, the fourth has a different y-axis. So far my code looks > > something like this: > > X1=[x1 x2 x3]; > > Y1=[y1 y2 y3]; > > plotyy(X1,Y1,x4,y4) > > > > I do get a plot but I am not to satisified with the result. First, I > > would like to set the line type for each serie individually. For example > > I would like (x1,y1,'-'), (x2,y2,':') etcetera, but I do not see how I > > can do something like that using plotyy. Also, Matlab "chooses" to give > > more space to my fourth serie. That is, there is a lot of white space > > above my first three series. But actually, my first three series are > > more important than the fourth serie, so I would like the first three > > series to just fit in the plot while the fourth one adapts. How should I > > adapt my code to get the desired results? Many thanks for your help. > > Save the handles when do the initial plotyy call and then use get/set on > those handles to modify the axes properties to suit. > > > [ax,h1,h2] = plotyy(X1,Y1,x4,y4); %Save handles > > doc plotyy > > get(ax(1) will display all properties of the axis...in particular you're > interested in the line style of the plot lines and the 'Ylim' property > of the axes. > > doc axis % may be useful in the latter... > > -- > > > -- Thanks for your help dpb but I am still struggling a little with the use of the set and the get function. I wrote the following piece of code: [AX,H1,H2]=plotyy(X1,Y1,x4,y4); optionsaxis1=get(AX(1)); optionsaxis1.YLim=[0,2.5E-5]; optionsaxis2=get(AX(2)); options1=get(H1(1)); options2=get(H1(2)); options2.LineStyle=':'; options3=get(H1(3)); options3.LineStyle='--'; options4=get(H2); options4.LineStyle='.-'; Now I would be very happy if I could get a plot with the first Y-axis created by using optionsaxis1, and attached to it lines created by options1, options2, options3 and the second Y-axis created by optionsaxis2 and attached to it the line created by options4. There must be a function that is able to do something like this, but I cannot find it anywhere.
From: dpb on 21 Jun 2010 08:33 Floris Zoutman wrote: > dpb <none(a)non.net> wrote in message .... >> Save the handles when do the initial plotyy call and then use get/set >> on those handles to modify the axes properties to suit. >> >> >> [ax,h1,h2] = plotyy(X1,Y1,x4,y4); %Save handles >> >> doc plotyy >> >> get(ax(1) will display all properties of the axis...in particular >> you're interested in the line style of the plot lines and the 'Ylim' >> property of the axes. >> >> doc axis % may be useful in the latter... >> .... > Thanks for your help dpb but I am still struggling a little with the use > of the set and the get function. I wrote the following piece of code: > [AX,H1,H2]=plotyy(X1,Y1,x4,y4); > optionsaxis1=get(AX(1)); > optionsaxis1.YLim=[0,2.5E-5]; > optionsaxis2=get(AX(2)); > options1=get(H1(1)); > options2=get(H1(2)); > options2.LineStyle=':'; > options3=get(H1(3)); > options3.LineStyle='--'; > options4=get(H2); > options4.LineStyle='.-'; > > Now I would be very happy if I could get a plot with the first Y-axis > created by using optionsaxis1, and attached to it lines created by > options1, options2, options3 and the second Y-axis created by > optionsaxis2 and attached to it the line created by options4. There must > be a function that is able to do something like this, but I cannot find > it anywhere. That function would be set() doc set % and friends Also, read the "getting started" section on graphics; specifically sections on customizing plots. Many examples using get/set to modify default properties are shown. Basically, all you need do w/ get() here is to use it to see (interactively) the properties you're interested in. Use set() to change a selected one of those properties. set(H1(1), 'linestyle', ':'); % for example...salt to suit... you can, as noted use the axis() function directly for the limits (it's just a wrapper around set() I notice in the release I have the 'linestyle' property doesn't seem to like using the array of handles so you may need/want to do something like (for example, w/ 3)... lstyle = {':';'--';'-.'}; for idx=1:3,set(h(idx),'linestyle',lstyle{idx}),end Again, salt to suit... --
From: Floris Zoutman on 21 Jun 2010 08:59 Thanks you for your help. My figure looks perfect now. dpb <none(a)non.net> wrote in message <hvnmc5$rqd$1(a)news.eternal-september.org>... > Floris Zoutman wrote: > > dpb <none(a)non.net> wrote in message > ... > > >> Save the handles when do the initial plotyy call and then use get/set > >> on those handles to modify the axes properties to suit. > >> > >> > >> [ax,h1,h2] = plotyy(X1,Y1,x4,y4); %Save handles > >> > >> doc plotyy > >> > >> get(ax(1) will display all properties of the axis...in particular > >> you're interested in the line style of the plot lines and the 'Ylim' > >> property of the axes. > >> > >> doc axis % may be useful in the latter... > >> > ... > > Thanks for your help dpb but I am still struggling a little with the use > > of the set and the get function. I wrote the following piece of code: > > [AX,H1,H2]=plotyy(X1,Y1,x4,y4); > > optionsaxis1=get(AX(1)); > > optionsaxis1.YLim=[0,2.5E-5]; > > optionsaxis2=get(AX(2)); > > options1=get(H1(1)); > > options2=get(H1(2)); > > options2.LineStyle=':'; > > options3=get(H1(3)); > > options3.LineStyle='--'; > > options4=get(H2); > > options4.LineStyle='.-'; > > > > Now I would be very happy if I could get a plot with the first Y-axis > > created by using optionsaxis1, and attached to it lines created by > > options1, options2, options3 and the second Y-axis created by > > optionsaxis2 and attached to it the line created by options4. There must > > be a function that is able to do something like this, but I cannot find > > it anywhere. > > That function would be set() > > doc set % and friends > > Also, read the "getting started" section on graphics; specifically > sections on customizing plots. Many examples using get/set to modify > default properties are shown. > > Basically, all you need do w/ get() here is to use it to see > (interactively) the properties you're interested in. Use set() to > change a selected one of those properties. > > set(H1(1), 'linestyle', ':'); % for example...salt to suit... > > you can, as noted use the axis() function directly for the limits (it's > just a wrapper around set() > > I notice in the release I have the 'linestyle' property doesn't seem to > like using the array of handles so you may need/want to do something > like (for example, w/ 3)... > > lstyle = {':';'--';'-.'}; > for idx=1:3,set(h(idx),'linestyle',lstyle{idx}),end > > Again, salt to suit... > > -- >
|
Pages: 1 Prev: Reading .mfc file Next: ROI wavelet coefficients |