standard abbreviation for pyplot or pylab?

referring to: http://news.gmane.org/find-root.php?message_id=<c7009a550804100055g6388b20ej520e85d8e679a55%40mail.gmail.com>

There was a slightly jumbled set of threads on Numpy-discussion that included a discussion of standardizing imports, like this:

import numpy as np
import scipy as sp

and then this was added, as something else that had been agreed at the same sprint:

import pylab as plt

I think this is a mistake, and it should have been

import matplotlib.pyplot as plt

because, for most production code, we don't want to be accessing numpy indirectly via pylab. I suspect it was just a slip-up by the poster, but since I was not involved in whatever discussion led to "plt", and the thread was going in several directions at once, I did not want to jump in.

We should get this straight, however. Note that the point is not to tell users that they must use a particular form, but to try to standardize the usage in the projects themselves, including examples and documentation, so as to reduce confusion among new users.

Eric

This is what we agreed to (import matplotlib.pyplot as plt) during the
numpy sprint (I was on google chat remotely but participated in the
discussion). I agree that pylab as plt would just add to the
confusion. We agreed on promoting (and I currently use)

import numpy as np
import scipy as sp
import matplotlib.pyplot as plt

JDH

···

On Sat, Apr 12, 2008 at 2:19 PM, Eric Firing <efiring@...229...> wrote:

referring to:
http://news.gmane.org/find-root.php?message_id=<c7009a550804100055g6388b20ej520e85d8e679a55%40mail.gmail.com>

There was a slightly jumbled set of threads on Numpy-discussion that
included a discussion of standardizing imports, like this:

import numpy as np
import scipy as sp

and then this was added, as something else that had been agreed at the
same sprint:

import pylab as plt

I think this is a mistake, and it should have been

import matplotlib.pyplot as plt

Sorry, that was my mistake. Thanks for clearing it up.

···

On Sat, Apr 12, 2008 at 3:24 PM, John Hunter <jdh2358@...149...> wrote:

On Sat, Apr 12, 2008 at 2:19 PM, Eric Firing <efiring@...229...> wrote:
> and then this was added, as something else that had been agreed at the
> same sprint:
> import pylab as plt
> I think this is a mistake, and it should have been
>
> import matplotlib.pyplot as plt

This is what we agreed to (import matplotlib.pyplot as plt) during the
numpy sprint (I was on google chat remotely but participated in the
discussion). I agree that pylab as plt would just add to the
confusion. We agreed on promoting (and I currently use)

import numpy as np
import scipy as sp

import matplotlib.pyplot as plt

--
Jarrod Millman
Computational Infrastructure for Research Labs
10 Giannini Hall, UC Berkeley
phone: 510.643.4014
http://cirl.berkeley.edu/