Why is wrapper module called "pylab" ?

So is matplotlib the name of the low level plotting engine?

And, pylab is the user-friendly wrapper?

Would it be ok to call the whole system "Pylab" instead of Matplotlib then?

Chris

chris@...1388... ha scritto:

So is matplotlib the name of the low level plotting engine?

And, pylab is the user-friendly wrapper?

Would it be ok to call the whole system "Pylab" instead of Matplotlib then?

Personally I'd say "no" exactly because they are two different things,
as you correctly pointed out.

m.

Pylab is just a name for a module in matplotlib that is supposed to mimic matlab. I would say its intent it to ease the transition for matlab users. It wouldn’t really make sense to refer to matplotlib as pylab. The matplotlib.pyplot is favored over the pylab module now.

  • Charlie
···

On Sun, Oct 26, 2008 at 1:28 AM, <chris@…1388…> wrote:

So is matplotlib the name of the low level plotting engine?

And, pylab is the user-friendly wrapper?

Would it be ok to call the whole system “Pylab” instead of Matplotlib then?

Chris


This SF.Net email is sponsored by the Moblin Your Move Developer’s challenge

Build the coolest Linux based applications with Moblin SDK & win great prizes

Grand prize is a trip for two to an Open Source event anywhere in the world

http://moblin-contest.org/redirect.php?banner_id=100&url=/


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Thanks! I find your comment very interesting. As I have negligible experience
with Matlab, I'd love to use matplotlib.pyplot.

The problem is all the docs use pylab right? Where find matplotlib.pyplot
examples?

Chris

···

On Sun, Oct 26, 2008 at 11:51:48AM -0400, Charlie Moad wrote:

The matplotlib.pyplot is favored over the pylab module now.

They’re the same plotting interface, just different names. Pylab pulls in a few extra functions that aren’t specific to plotting, but aid in providing matlab-alike functionality. To use matplotlib.pyplot instead of pylab for any of the examples, just replace lines of:

import pylab

with:

import matplotlib.pyplot

Ryan

···

On Sun, Oct 26, 2008 at 11:29 AM, <chris@…1388…> wrote:

On Sun, Oct 26, 2008 at 11:51:48AM -0400, Charlie Moad wrote:

The matplotlib.pyplot is favored over the pylab module now.

Thanks! I find your comment very interesting. As I have negligible experience

with Matlab, I’d love to use matplotlib.pyplot.

The problem is all the docs use pylab right? Where find matplotlib.pyplot

examples?

Chris


This SF.Net email is sponsored by the Moblin Your Move Developer’s challenge

Build the coolest Linux based applications with Moblin SDK & win great prizes

Grand prize is a trip for two to an Open Source event anywhere in the world

http://moblin-contest.org/redirect.php?banner_id=100&url=/


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

Ryan May wrote:

They're the same plotting interface, just different names. Pylab pulls in a few extra functions that aren't specific to plotting, but aid in providing matlab-alike functionality. To use matplotlib.pyplot instead of pylab for any of the examples, just replace lines of:

    import pylab

with:

    import matplotlib.pyplot

Not quite--the above, taken literally, will not actually work.

To elaborate: pyplot provides a matlab-style state-machine interface to the underlying object-oriented interface in matplotlib. Pylab lumps pyplot together with numpy in a single namespace, making that namespace (or environment) even more matlab-like, particularly if one uses the ipython shell with the "-pylab" option, which imports everything from pylab.

Regarding matplotlib examples: we have been gradually converting them from pure matlab-style, using "from pylab import *", to a preferred style in which pyplot is used for some convenience functions, either pyplot or the object-oriented style is used for the remainder of the plotting code, and numpy is used explicitly for numeric array operations.

In this preferred style, the imports at the top are:

import matplotlib.pyplot as plt
import numpy as np

Then one calls, for example, np.arange, np.zeros, np.pi, plt.figure, plt.plot, plt.show, etc.

Example, pure matlab-style:

from pylab import *
x = arange(0, 10, 0.2)
y = sin(x)
plot(x, y)
show()

Now in preferred style, but still using pyplot interface:

import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 10, 0.2)
y = np.sin(x)
plt.plot(x, y)
plt.show()

And using pyplot convenience functions, but object-orientation for the rest:
import matplotlib.pyplot as plt
import numpy as np
x = np.arange(0, 10, 0.2)
y = np.sin(x)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x, y)
plt.show()

So, why do all the extra typing required as one moves away from the pure matlab-style? For very simple things like this example, the only advantage is educational: the wordier styles are more explicit, more clear as to where things come from and what is going on. For more complicated applications, the explicitness and clarity become increasingly valuable, and the richer and more complete object-oriented interface will likely make the program easier to write and maintain.

Eric

···

Ryan

On Sun, Oct 26, 2008 at 11:29 AM, <chris@…1388… > <mailto:chris@…1388…>> wrote:

    On Sun, Oct 26, 2008 at 11:51:48AM -0400, Charlie Moad wrote:
     > The matplotlib.pyplot is favored over the pylab module now.

    Thanks! I find your comment very interesting. As I have negligible
    experience
    with Matlab, I'd love to use matplotlib.pyplot.

    The problem is all the docs use pylab right? Where find
    matplotlib.pyplot
    examples?

    Chris

    -------------------------------------------------------------------------
    This SF.Net email is sponsored by the Moblin Your Move Developer's
    challenge
    Build the coolest Linux based applications with Moblin SDK & win
    great prizes
    Grand prize is a trip for two to an Open Source event anywhere in
    the world
    http://moblin-contest.org/redirect.php?banner_id=100&url=/
    <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users@lists.sourceforge.net
    <mailto:Matplotlib-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users