Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-22 Thread Jae-Joon Lee
On Sun, Mar 21, 2010 at 8:10 PM, Fernando Perez fperez@gmail.com wrote: Mmh, back to this one: I do think it would be something useful to have somewhere, because typing draw() after *every* operation when working interactively does get tiresome, it seems to me...  If we encourage calling

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-22 Thread Jörgen Stenarson
Fernando Perez skrev 2010-03-22 01:10: On Sat, Mar 20, 2010 at 4:00 PM, Jae-Joon Leelee.j.j...@gmail.com wrote: On Sat, Mar 20, 2010 at 5:05 AM, Fernando Perezfperez@gmail.com wrote: I wonder if it's possible to put things like a draw_if_interactive() call at the end of the OO methods...

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-22 Thread John Hunter
On Mon, Mar 22, 2010 at 11:50 AM, Jörgen Stenarson jorgen.stenar...@bostream.nu wrote: Would it be possible to put the draw in the ipython_prompt hook. That way it is always called after you have done something. I like this approach better, because one problem with doing it in the mpl Artist

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Jae-Joon Lee
On Sat, Mar 20, 2010 at 8:40 PM, Eric Firing efir...@hawaii.edu wrote: Done in svn 8205. Thanks! Or, how about we make axes an context manager. This would require dropping support for Python 2.4. I don't think making the Axes a context manager means dropping python 2.4 support (note that

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Ryan May
On Sun, Mar 21, 2010 at 12:35 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Sat, Mar 20, 2010 at 8:40 PM, Eric Firing efir...@hawaii.edu wrote: Or, how about we make axes an context manager. This would require dropping support for Python 2.4. I don't think making the Axes a context manager

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Eric Firing
Ryan May wrote: On Sun, Mar 21, 2010 at 12:35 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Sat, Mar 20, 2010 at 8:40 PM, Eric Firing efir...@hawaii.edu wrote: Or, how about we make axes an context manager. This would require dropping support for Python 2.4. I don't think making the Axes a

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Jae-Joon Lee
On Sat, Mar 20, 2010 at 8:40 PM, Eric Firing efir...@hawaii.edu wrote: By the way, given that we now have suplots in the pyplot namespace, can we have sca also? Done in svn 8205. Eric, A minor question. I wonder whether an explicit for-loop inside pyplot.sca is necessary? Here is a

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Eric Firing
Jae-Joon Lee wrote: On Sat, Mar 20, 2010 at 8:40 PM, Eric Firing efir...@hawaii.edu mailto:efir...@hawaii.edu wrote: By the way, given that we now have suplots in the pyplot namespace, can we have sca also? Done in svn 8205. Eric, A minor

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Jae-Joon Lee
On Sun, Mar 21, 2010 at 6:07 PM, Eric Firing efir...@hawaii.edu wrote: I think your version would need an additional try/except or conditional, because a Figure doesn't necessarily have a canvas assigned to it, and a canvas doesn't necessarily have a manager. Granted, the problem would arise

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-21 Thread Fernando Perez
On Sat, Mar 20, 2010 at 4:00 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: On Sat, Mar 20, 2010 at 5:05 AM, Fernando Perez fperez@gmail.com wrote: I wonder if it's possible to put things like a draw_if_interactive() call at the end of the OO methods... I realize that pyplot was the only one

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-20 Thread Fernando Perez
On Thu, Mar 18, 2010 at 6:39 PM, John Hunter jdh2...@gmail.com wrote: I also think the name should be changed, and there should be an entry in the matplotlib.figure.Figure API.  One additional suggestion is subarray and matplotlib.pyplot.subarray would be a thin wrapper to

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-20 Thread Jae-Joon Lee
On Sat, Mar 20, 2010 at 5:05 AM, Fernando Perez fperez@gmail.com wrote: I wonder if it's possible to put things like a draw_if_interactive() call at the end of the OO methods... I realize that pyplot was the only one meant to do that, but if we are to encourage using the OO api more, then

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-20 Thread Eric Firing
Jae-Joon Lee wrote: By the way, given that we now have suplots in the pyplot namespace, can we have sca also? Done in svn 8205. For example, # Two subplots, the axes array is 1-d f, axarr = subplots(2, sharex=True) sca(axarr[0]) plot(x, y) title('Sharing X axis')

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-19 Thread Christopher Barker
Fernando Perez wrote: I personally think that this should be the way to use mpl in general when scripting, and the way I want to teach, + Inf ! I've wanted to do this for years (make a easier way to do scripting the OO way), but I only get around to a tiny fraction of the things I want to

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread Eric Firing
Fernando Perez wrote: Howdy, On Wed, Feb 24, 2010 at 11:27 AM, Fernando Perez fperez@gmail.com wrote: OK, since I know people are busy, I took silence as acquiescence. Committed in r8151, please let me know if I messed anything up and I'll try to fix it. I'm used to the numpy docstring

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread Ryan May
On Thu, Mar 18, 2010 at 12:20 PM, Eric Firing efir...@hawaii.edu wrote: Fernando Perez wrote: While chatting today with John, he suggested that a better api for this would be to return an *array* of supblots, so that  one could index them with a[i,j] for the plot in row i, column j.  I've

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread Christopher Barker
Fernando Perez wrote: While chatting today with John, he suggested that a better api for this would be to return an *array* of supblots, so that one could index them with a[i,j] for the plot in row i, column j. That would be nice. implemented this already, but before committing it, I have

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread John Hunter
On Thu, Mar 18, 2010 at 1:38 PM, Christopher Barker chris.bar...@noaa.gov wrote: I think the only two options should be scalar or 2-d array, it seems a bit much to have a 1-d array option as well. I disagree here -- if you are 2,1 or 1,2 rows x cols, 1D indexing is natural. This is also the

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread Christopher Barker
John Hunter wrote: I think the only two options should be scalar or 2-d array, it seems a bit much to have a 1-d array option as well. I disagree here -- if you are 2,1 or 1,2 rows x cols, 1D indexing is natural. This is also the most common use case so the most important to get right.

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread John Hunter
On Thu, Mar 18, 2010 at 2:24 PM, Christopher Barker chris.bar...@noaa.gov wrote: John Hunter wrote: I think the only two options should be scalar or 2-d array, it seems a bit much to have a 1-d array option as well. I disagree here -- if you are 2,1 or 1,2 rows x cols, 1D indexing is

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread Fernando Perez
On Thu, Mar 18, 2010 at 11:47 AM, John Hunter jdh2...@gmail.com wrote: I disagree here -- if you are 2,1 or 1,2 rows x cols, 1D indexing is natural.  This is also the most common use case so the most important to get right.  If you aren't doing multiple subplots, a plain ol subplot(111) may be

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread Christopher Barker
Fernando Perez wrote: Based on the feedback, I'll finish it tonight with squeeze=True as a kwarg, that behaves: - if True (default): single axis is returned as a scalar, Nx1 or 1xN are returned as numpy 1-d arrays, and only NxM with N1 and M1 are returned as a 2d array. - if False, no

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-03-18 Thread John Hunter
On Thu, Mar 18, 2010 at 7:46 PM, Fernando Perez fperez@gmail.com wrote: On Thu, Mar 18, 2010 at 3:49 PM, Christopher Barker chris.bar...@noaa.gov wrote: Good solution, and thanks for working on this! Thanks. I have one more question on this feature.  I personally think that this

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-24 Thread Fernando Perez
On Tue, Feb 23, 2010 at 10:14 PM, Fernando Perez fperez@gmail.com wrote: Final question: should I put the little demo code at the bottom that I used for testing this up in an example file?  I put some of that in the docstring as an example, but not all to avoid clutter. OK, since I know

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-23 Thread Fernando Perez
On Sat, Feb 20, 2010 at 3:50 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: After quickly going through the mpl source (and in my experience), I think it is quite safe to assume that there is no master-slave relation among the shared axes. One more, related question: is it

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-20 Thread Jae-Joon Lee
On Thu, Feb 18, 2010 at 11:50 PM, Fernando Perez fperez@gmail.com wrote: I defer to your wisdom here: I had no clue about this, so I went for the clumsier API.  If you are right, it would also make the implementation much simpler, as I had to play some not-totally-obvious gymnastics to

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-18 Thread John Hunter
On Wed, Feb 17, 2010 at 10:50 PM, Fernando Perez fperez@gmail.com wrote: This is a worthy goal.    One use case I would like to see supported is the sharex/sharey args:: Sheesh, some people really want everything :) Yes, you should know better by now than to propose a minor

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-18 Thread Christopher Barker
John Hunter wrote: One other thing: I don't think a tuple is best for the axes dimensionality. We always require two and exactly two shape arguments (numrows, numcols) so we don't need the flexibility of the tuple in the way that numpy.zeros does. And it is easier to type::

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-18 Thread Jae-Joon Lee
On Wed, Feb 17, 2010 at 10:17 PM, John Hunter jdh2...@gmail.com wrote: Perhaps the solution to my sharex conundrum is to support an axes number, eg  ax1, ax2, ax3, ax4 = subplots(4,1, sharex=1) I thought there is no master and slave for an axis-sharing? If that's the case, maybe sharex=True

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-18 Thread Fernando Perez
On Thu, Feb 18, 2010 at 8:02 AM, John Hunter jdh2...@gmail.com wrote: Yes, you should know better by now than to propose a minor enhancement And you should know by know common sense has somehow been amputated from my system :) Another thought about the interface.  How about *just*

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-18 Thread Fernando Perez
Howdy On Thu, Feb 18, 2010 at 1:19 PM, Jae-Joon Lee lee.j.j...@gmail.com wrote: I thought there is no master and slave for an axis-sharing? If that's the case, maybe sharex=True should be suffice? I defer to your wisdom here: I had no clue about this, so I went for the clumsier API. If you

[matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-17 Thread Fernando Perez
Howdy, in trying to teach a more structured use of mpl, I keep getting annoyed by the whole figure(), add_subplot(), grab axes dance. I've also seen students get confused by it. Does something along these lines sound useful to have in the core (see attached)? In use, below. You'd normally

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-17 Thread Christopher Barker
Fernando Perez wrote: in trying to teach a more structured use of mpl, good for you! I always felt that to efficiently use the OO interface, there needed to be some more utility functions like this: In [37]: figaxes() Out[37]: (matplotlib.figure.Figure object at 0xa24b4cc,

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-17 Thread David Warde-Farley
On 17-Feb-10, at 6:52 PM, Fernando Perez wrote: Howdy, in trying to teach a more structured use of mpl, I keep getting annoyed by the whole figure(), add_subplot(), grab axes dance. I've also seen students get confused by it. Does something along these lines sound useful to have in the

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-17 Thread Fernando Perez
On Wed, Feb 17, 2010 at 7:27 PM, David Warde-Farley d...@cs.toronto.edu wrote: An effusive yes, yes, good god yes! from this mpl-devel lurker. Thanks, that's two good pluses. Any suggestions on name changes, or other fixes to make? Otherwise, once I find a free minute I'll put it in. Should

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-17 Thread John Hunter
On Wed, Feb 17, 2010 at 8:29 PM, Fernando Perez fperez@gmail.com wrote: On Wed, Feb 17, 2010 at 7:27 PM, David Warde-Farley d...@cs.toronto.edu wrote: An effusive yes, yes, good god yes! from this mpl-devel lurker. Thanks, that's two good pluses. Any suggestions on name changes, or

Re: [matplotlib-devel] An easier way to create figure and group of axes; useful?

2010-02-17 Thread Fernando Perez
On Wed, Feb 17, 2010 at 10:17 PM, John Hunter jdh2...@gmail.com wrote: I think the name figsubplots or fig_subplots is better because you are creating Subplot instances.  Alternatively, you might want to consider simply subplots which returns just the list of subplots: the figure can always be