On Wednesday 12 July 2006 7:19 pm, you wrote:
> Darren Dale wrote:
> > On Wednesday 12 July 2006 16:16, Mark Bakker wrote:
> >>I am following up on the discussion of passing a single 2D array to plot.
> >>Wouldn't it make more sense that, in Python array style,
> >>if you give it a single N x K argument you plot rows against the first
> >> row?
> >
> > That's not the behavior I would have expected. I would have expected each
> > row to be plotted as a funtion of the column index, just like
> > plot([1,2,3,4]) is done now, but with each row in a different color. I
> > would like
> > plot([1,2,3,4], array([[1,2,3,4],[2,3,4,5]])) to plot two lines as a
> > function of the single x-list, and I would like 
> > plot(array([[1,2,3,4],[2,3,4,5]]), array([[1,2,3,4],[2,3,4,5]])) to take
> > the next obvious step. I *think* matlab does this, but its been so long
> > since I used it...
>
> I was afraid someone would bring up these possibilities...

Let me temper what I said. *If* a change was considered, what I described 
seems to be the most intuitive behavior.

> We are going to have some tradeoffs among matlab compatibility, internal
> consistency, and adherence to the underlying data storage model.

agreed

> Here is what Matlab does (and in one respect it is not what I thought I
> remembered):
>
> 1) Given a single NxK matrix, it plots each column against the row index.
>
> 2) Given a vector and an NxK, it plots each column against the vector.
>
> 3) Given an NxK and a vector, it plots the vector against each column.
>
> 4) Given an NxK and an NxK it plots each column from the second against
> the corresponding column of the first.
>
> I think this is a good model: fairly simple, consistent, intuitive, and
> covers a good range of real-life situations.  It differs from what I
> thought I remembered, and from what I think Stefan requested, in that,
> given an Nx2, it does not plot the second column against the first.
> That behavior, however, does not generalize nicely to NxK for any K!=2,
> so I now think we should choose either one or the other.   A virtue of
> Stefan's Nx2 proposal is that it is consistent with the changes I made
> to elsewhere so that paths can be specified as Nx2 arrays; this, in
> turn, was consistent with the original specification as sequences of
> (x,y) tuples.  But plot has never used sequences of (x,y) tuples, so the
> argument for the Nx2 form is weaker here.
>
> I don't know whether the reason Matlab chooses the columns as the data
> vectors is because of the Fortran storage order Matlab uses, or whether
> there is some other reason. 

I believe this is the reason.

> Personally I am very comfortable with it, 
> perhaps simply because of my Matlab experience.  I think part of it is
> that columns in a table seem more natural as data vectors than rows,
> however; tables are usually oriented so that columns (fields) are
> different variables, and the row index is the sample number, or time, or
> a spatial coordinate.
>
> To summarize, the options seem to be:
>
> 1) Leave plot argument parsing alone.
> 2) Accept an Nx2 array in place of a pair of arguments containing x and y.
>
> 3) Implement the Matlab model.
> 4) Implement the Matlab model, but taking rows instead of columns in an
> X or Y array that is 2-D.
>
> I am open to arguments, but my preference is the Matlab model.  I don't
> think that the difference in native array storage order matters much.
> It is more important to have the API at the plot method and function
> level match the way people think.

I would probably use 4, but not 3. I don't like the sound of 2. But that's 
just my opinion. 

Darren


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to