Re: Plotyy Problems



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.

--
.



Relevant Pages

  • Re: Area Charts With Negative Numbers
    ... to shift all the benchmark points to be non-negative and then plot ... > I'm curious if anyone has had success trying to design an area chart ... > 3) Currently I'm generating line plots for all the arrays. ... Then I put the shifted graph below another graph ...
    (microsoft.public.excel)
  • Re: extract arrays according the number of consecutive values
    ... different plots on a same graph when the value in column A changes.I managed to have 2 arrays (thanks to the forum with some ... modifications):-One to tell me each first indexes when the value changes-One to tell me each last indexes when the values changesMy idea would be to use theses indexes to split the initial ... arrays will be created when I will try to split the initial array.Is someone know if this solution is possible?Thank you in advance for the help. ...
    (comp.lang.labview)
  • Re: [opensuse] Lies, damned lies and statistics
    ... Recently we have done a poll around the office. ... line with bash/sed/awk and then produce graphs from that, then spline, graph ... GNU 'plot' is then called to display a graph on the screen: ...
    (SuSE)
  • Help needed in ploting graphs in GUI
    ... I am trying to make a graph in the GUI which plots itself ... when the user pushes a pushbutton. ... plot the current data as well as the previous data. ...
    (comp.soft-sys.matlab)
  • Problem with sin/cos of complex signal
    ... You'll see if you run it that the signal appears to graph ok in both real and imaginary, but the sin and cosine don't appear to have anything to do with the signal itself. ... %LAB1_SEC3.1_SOURCE_CODE quick script to run part of lab 1 ... plot; ... title('Imaginary Sample Data, Lab 1 Section 3.1'); ...
    (comp.soft-sys.matlab)