why does matplotlib require numarray?

1) I'm wondering if there's a way to pre-define different

    > defaults for different platforms. For example, I built an
    > OS-X installer that doesn't support GTK, but the
    > .matplotlibrc still had GtkAgg as the default. Yes, I could
    > have edited the .matplotlib rc in my installer, but I'd
    > have to do that each time I built a new one. It would be
    > nice to have something in CVS that just worked.

This is what I do for the win32 builds -- hand edit the file before
each build. A little bit of a pain, bit it works (as long as you
remember to tweak the file before the build <wink>)

    > 2) Perhaps we could make the processing of matplotlibrc
    > smarter. For example: if numarray is specified, but not
    > installed, and Numeric is, it could roll over to
    > Numeric. Same thing with back-ends. Of course, this kind of
    > breaks the "explicit is better than implicit" rule, but it
    > would greatly improve the "It just works" qualities of MPL.

There is a consensus that the backend selector should be smarter. One
proposal is to iterate over a list of candidates and choose the first
one that works. Another is to set the backend in the default rc file
at setup.py build time. Both could be done, and the same arguments
apply to the numerix setting (AFAIK, These are the only two rc file
settings that might be advantageously set at build time).

I think we would readily accept a patch for either or both of these,
but there are those who already despise the amount of magic that pylab
engages in (and you are usually near the front of that chorus). Yes,
explicit is (usually) better than implicit, but this tends to conflict
with "just works".... Are you starting to experience a change of
heart :slight_smile: ?

FYI, the advertised behavior of numeric is as follows (eg
http://matplotlib.sf.net/matplotlib.numerix.html)

  numerix imports either Numeric or numarray based on various
  selectors.

  0. If the value "--numarray" or "--Numeric" is specified on the
      command line, then numerix imports the specified array package.

  1. The value of numerix in matplotlibrc: either Numeric or numarray

  2. If none of the above is done, the default array package is
     Numeric. Because the matplotlibrc always provides *some* value
     for numerix (it has it's own system of default values), this
     default is most likely never used.

  To summarize: the commandline is examined first, the rc file second,
  and the default array package is Numeric.

In your use case is this correct, or do we need to amend the build,
runtime or docs? According to your post, we should fall back on
Numeric if numarray is specified but not present. Reasonable, but
also a bit counter-intuitive since Numeric is the default and in this
case the user would have explicitly overridden the default. In the
case of an explicit override from the default, failing might be better
than just working....

JDH

[snip, snip]

To summarize: the commandline is examined first, the rc file second,
and the default array package is Numeric.

In your use case is this correct, or do we need to amend the build,
runtime or docs? According to your post, we should fall back on
Numeric if numarray is specified but not present. Reasonable, but
also a bit counter-intuitive since Numeric is the default and in this

case the user would have explicitly overridden the default. In the
case of an explicit override from the default, failing might be better
than just working…

How
about a setup.py option where you can explicitly set numeric or
numarray, such as “–use=numarray”? This optional will build MPL for
numarray and modify the rc file so that it doesn’t have to be edited by
hand.

– Paul

Paul Barrett wrote:

How about a setup.py option where you can explicitly set numeric or

numarray, such as "--use=numarray"? This optional will build MPL for
numarray and modify the rc file so that it doesn't have to be edited by
hand.

I'm confused. Is this a proposal, or is it implemented now? Either way, I like it.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

John Hunter wrote:

This is what I do for the win32 builds -- hand edit the file before
each build. A little bit of a pain, bit it works (as long as you
remember to tweak the file before the build <wink>)

I guess I could write a little script that did it for me easily enough. Who else is building MPL on OS-X. I may not have as much need for it now, we're moving a web app that uses it from an OS-X box to a Linux box.

I think we would readily accept a patch for either or both of these,
but there are those who already despise the amount of magic that pylab
engages in (and you are usually near the front of that chorus).

Do you mean me? If so, I'm not sure, what I've objected to a lot are two things: procedural, rather than OO style; and compatibility with Matlab, rather than Python. Magic is OK, as long as it's easily over-written. In this case, as long as I can do:

import matplotlib
matplotlib.use(...)

I'm happy.

Yes,
explicit is (usually) better than implicit, but this tends to conflict
with "just works".... Are you starting to experience a change of
heart :slight_smile: ?

I like to think I've been totally consistent....

In your use case is this correct, or do we need to amend the build,
runtime or docs? According to your post, we should fall back on
Numeric if numarray is specified but not present. Reasonable, but
also a bit counter-intuitive since Numeric is the default and in this
case the user would have explicitly overridden the default.

I'm not the OP, but I got the impression that his .matplotlibrc had numarray in it, even though it was not installed, and he hadn't edited it, so there was a mistake somewhere. Where, I don't know.

-CHB

···

--
Christopher Barker, Ph.D.
Oceanographer
                                         
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@...259...

It’s a proposal. It’s also explicit. :slight_smile:

– Paul

···

On 11/4/05, Chris Barker <Chris.Barker@…259…> wrote:

Paul Barrett wrote:

How about a setup.py option where you can explicitly set numeric or

numarray, such as “–use=numarray”? This optional will build MPL for
numarray and modify the rc file so that it doesn’t have to be edited by

hand.

I’m confused. Is this a proposal, or is it implemented now? Either way,
I like it.