numpification and imports

Yes - it doesn't solve or address the recursive import problem. My impression was that Tom was making a user interface assertion that doing:

import matplotlib as mpl

would be simpler for people than doing:

from matplotlib import mpl

of course I could be complete wrong as well :slight_smile:

I think the basic idea is that if I want to use MPL, I should import it and go and I should not have to import a sub-module out of MPL as the main API.

路路路

At 01:25 PM 7/13/2007, John Hunter wrote:

On 7/13/07, Ted Drain <ted.drain@...179...> wrote:
> I think he means that the matplotlib/__init__.py file should be
> changed to that those things are imported.

but if __init__.py imports axes, and axes import matplotlib, don't we
still have the problem of recursive imports?

JDH

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Ted Drain Jet Propulsion Laboratory ted.drain@...179...

Ted Drain wrote:

I think the basic idea is that if I want to use MPL, I should import it and go and I should not have to import a sub-module out of MPL as the main API.

Yeah, about that, my typical usage is actually "from pylab import *".
I guess I am unclear about the relationship between matplotlib and pylab.

路路路

--
Tom Holroyd, Ph.D.
"The fundamentally misconceived nature versus nurture debate should be
abandoned: child development is inextricably both." -- Louann Brizendine

Tom Holroyd (NIH/NIMH) [E] wrote:

Ted Drain wrote:

I think the basic idea is that if I want to use MPL, I should import it and go and I should not have to import a sub-module out of MPL as the main API.

Yeah, about that, my typical usage is actually "from pylab import *".
I guess I am unclear about the relationship between matplotlib and pylab.

Tom,

matplotlib is the object-oriented plotting library; pylab is a module within matplotlib that provides a matlab-style (state-machine) interface to the library.

Eric

Eric Firing wrote:

Tom Holroyd (NIH/NIMH) [E] wrote:

Ted Drain wrote:

I think the basic idea is that if I want to use MPL, I should import it and go and I should not have to import a sub-module out of MPL as the main API.

Yeah, about that, my typical usage is actually "from pylab import *".
I guess I am unclear about the relationship between matplotlib and pylab.

Tom,

matplotlib is the object-oriented plotting library; pylab is a module within matplotlib that provides a matlab-style (state-machine) interface to the library.

Eric

If I say

import matplotlib
help(matplotlib)

(This is with 0.90.0 by the way)

It basically gives me the help I'd expect for pylab. Oh, and it says "the" instead of "to". It's a little weird thinking of a library as the top level with the main interface as a module. I guess the interface is just another component of the library. Though when I

import pylab
help(pylab)

I get what looks like help for numpy. Perhaps my installation is strange?

路路路

--
Tom Holroyd, Ph.D.
"The fundamentally misconceived nature versus nurture debate should be
abandoned: child development is inextricably both." -- Louann Brizendine

Tom Holroyd (NIH/NIMH) [E] wrote:
[...]

If I say

import matplotlib
help(matplotlib)

(This is with 0.90.0 by the way)

It basically gives me the help I'd expect for pylab. Oh, and it says "the" instead of "to". It's a little weird thinking of a library as the top level with the main interface as a module. I guess the interface is just another component of the library. Though when I

import pylab
help(pylab)

I get what looks like help for numpy. Perhaps my installation is strange?

No, it is not your installation. You have identified an area that needs work, after we settle on a possibly new import and namespace strategy.

Eric

This is definitely something new -- help(pylab) used to display the
rather extensive pylab doc string, which starts with in pylab.py:

""
This is a matlab(TM) style interface to matplotlib.

The following plotting commands are provided; some of these do not
exist in matlab(TM) but have proven themselves to be useful
nonetheless.
The majority of them, however, have matlab analogs
...snip
"""

Are eggs doing something fishy here? This is a weird one.
JDH

路路路

On 7/13/07, Eric Firing <efiring@...229...> wrote:

No, it is not your installation. You have identified an area that needs
work, after we settle on a possibly new import and namespace strategy.

John Hunter wrote:

No, it is not your installation. You have identified an area that needs
work, after we settle on a possibly new import and namespace strategy.

This is definitely something new -- help(pylab) used to display the
rather extensive pylab doc string, which starts with in pylab.py:

""
This is a matlab(TM) style interface to matplotlib.

The following plotting commands are provided; some of these do not
exist in matlab(TM) but have proven themselves to be useful
nonetheless.
The majority of them, however, have matlab analogs
...snip
"""

Are eggs doing something fishy here? This is a weird one.
JDH

But it does it on linux, not using eggs. I couldn't figure it out--just assumed it had always done that, and I had never noticed.

Still, the matplotlib/__init__.py docstring could be changed to make clear the distinction between mpl and the pylab interface. Instead, it talks only about the latter:

efiring@...340...:~/programs/py/mpl/matplotlib_units/lib/matplotlib$ head __init__.py
"""
This is a matlab(TM) style functional interface the matplotlib.

The following matlab(TM) compatible commands are provided by

聽聽聽聽>>> from pylab import *

Plotting commands

聽聽聽axes - Create a new axes

Eric

路路路

On 7/13/07, Eric Firing <efiring@...229...> wrote:

Tom Holroyd (NIH/NIMH) [E] wrote:
[...]

If I say

import matplotlib
help(matplotlib)

(This is with 0.90.0 by the way)

It basically gives me the help I'd expect for pylab. Oh, and it says "the" instead of "to". It's a little weird thinking of a library as the top level with the main interface as a module. I guess the interface is just another component of the library. Though when I

import pylab
help(pylab)

I get what looks like help for numpy. Perhaps my installation is strange?

I have fixed this. The problem was that when you import pylab, it imports a stub "pylab.py" from site-packages, which in turn imports everything from matplotlib/pylab.py. The matplotlib.pylab docstring does not get transferred to the newly loaded pylab module, however. The solution was to do that transfer explicitly in the pylab.py stub. I also made slight tweaks to the pylab.py and matplotlib.py docstrings to try to clarify the pylab-matplotlib relationship. The matplotlib docstring still blathers on about pylab functions, however; I suspect we should change this to something more unique and helpful, such as a directory of matplotlib submodules and/or an intro to the useful things in matplotlib.__init__.py like rcParams.

Eric

\> docstring still blathers on about pylab functions, however; I suspect we

should change this to something more unique and helpful, such as a
directory of matplotlib submodules and/or an intro to the useful things
in matplotlib.__init__.py like rcParams.

Verg good idea -- are you volunteering? :slight_smile:

JDH

PS: in other news, I find it ironic that the gmail spell checker,
which underlines words it doesn't recognize with a red line (eg
rcParams), doesn't recognize the word "gmail"

路路路

On 7/15/07, Eric Firing <efiring@...229...> wrote:

John Hunter wrote:

路路路

On 7/15/07, Eric Firing <efiring@...229...> wrote:
\> docstring still blathers on about pylab functions, however; I suspect we

should change this to something more unique and helpful, such as a
directory of matplotlib submodules and/or an intro to the useful things
in matplotlib.__init__.py like rcParams.

Verg good idea -- are you volunteering? :slight_smile:

OK.

Eric