Re: Plotyy Problems
- From: dpb <none@xxxxxxx>
- Date: Wed, 23 Dec 2009 14:39:17 -0600
dpb wrote:
Gareth Jones wrote:dpb <none@xxxxxxx> wrote in message <hgqnce$j66$1@xxxxxxxxxxxxxxxxxxxxxxxxxx>...Gareth Jones wrote:
...
> I now have a graph that consists of two straight lines, plotted > diagonally across the plot area, however this doesn't seem > representative of my data.
> My code for the graph creation:
> > X = 0:10:100;
> Y1 = 0:10:100;
> Y2 = 0:300:3000;
> [AX,H1,H2] = plotyy(X,Y1,X,Y2,'plot');
Well, you just plotted the above arrays which are straight lines -- which is the question I raised earlier of why would you care to plot these against each other????
...
> As you can see, there is no reason why the lines should be dead straight > across the plot area.
Of course there is, you plotted the arrays you created not what you just displayed above.
> Am I correct in thinking that this is wrong?
The plot is right; just not what you intended.
Use your data arrays as the "y" values in the plot calls against whatever is the appropriate "x" value -- what would you use for data sources if you were plotting on a piece of graph paper manually? Use the _SAME_ data arrays for each line in plotyy()
Sorry about my ignorance on the subject, but what do you mean?!
Which data arrays do you consider independent and dependent for which plot? Use them. Together. In the same call paired together.
Don't know what else to tell you except you have to tell (by using the correct arguments in the correct position) plot() or plotyy() what are the y-axis values to plot against the x-axis for each line on the axes.
Again, all I can suggest is sit down and draw a few of the points on a pen-and-pencil graph from the data arrays/variables in your function and see which variables you're using for which direction--then make those the ones in the call.
Read
doc plotyy
and look at the examples and see how those work and mimic them.
This isn't rocket science; it's quite straightforward if you'll actually look at what it is you're trying to do...
And, it appears that you want either array Y or G as the first y-value and the other as the second. I'd guess X would be the abscissa for each but that is and assumption based solely on the existing plotyy() call you posted and there's no knowing from here if that's really what you intended or not. It's certainly confusing why you generated Y1==X and Y1 as another linear sequence not knowing what it is you really have.
It is true that you will need an "x-array" for each "y-array" that is of the same length as its corresponding length; what the x values associated w/ the two arrays you gave a short(?) sampling of are is impossible for anyone at c.s-s.m to know, of course.
--
.
- References:
- Plotyy Problems
- From: Gareth Jones
- Re: Plotyy Problems
- From: dpb
- Re: Plotyy Problems
- From: Gareth Jones
- Re: Plotyy Problems
- From: Steven Lord
- Re: Plotyy Problems
- From: Gareth Jones
- Re: Plotyy Problems
- From: dpb
- Re: Plotyy Problems
- From: Gareth Jones
- Re: Plotyy Problems
- From: dpb
- Plotyy Problems
- Prev by Date: Re: Ellipse Detection with matlab function
- Next by Date: Re: FIR filter vs. idealfilter
- Previous by thread: Re: Plotyy Problems
- Next by thread: Re: Plotyy Problems
- Index(es):
Relevant Pages
|