Keyword Parameters

Ok, I was so rattled when I wrote the previous message that I forgot
to ask my actual question:

I was trying to change backends midstream because I was only getting
b/w plots when I used pcolor--I couldn't change the colormap. At
first I thought that this was because I was using the Postscript
backend and for some reason it assumed I wanted b/w output for
printing. After fooling around with some of the other imaging
backends, I used one of the interactive ones (this is a pain b/c I'm
running Python remotely and I'm sitting at the end of a slow internet
link. Therefore interactive windows take forever to pop up. More on
this later), and the plot was still b/w.

After significant frustration, I realized that my problem was that I
was specifying the color map as 'cm=' instead of 'cmap='; a reasonable
guess since the rest of the line is 'cm.hot' The problem was that
matplotlib silently ignored my misspecified argument.

This is gripe #1: weak typing only works when using undefined
variables bites you on the nose. Otherwise we're back to the bad old
days of fortran, when misspelling a variable name silently defined a
new variable. It would be nice if somewhere in the heirarchy of
function calls within matplotlib someone checked to make sure there
were no lonely, unused keyword arguments sloshing around. I realize
that this is hard to do robustly and with any generality, but there's
a lot at stake. Python would be unusable if use-before-definition
didn't generate an exception.

Gripe #2 is that it would be nice if the same word were abbreviated
the same way everywhere. Ie, either cmap or cm, not both.

Gripe #3 is related to interactive windows when Python and the X11
server are connected by a slow link. All of the interactive backends
I've used for matplotlib look great, but render very slowly in this
situation b/c they're sending all the pixel data. Since most plots
consist of a few lines, a bit of text, and a few dots, it'd be nice if
the windows rendered quickly over slow connections. For example,
Gnuplot runs very well in this configuration. I realize that this
doesn't invovle matplotlib per se, I just wanted to throw it out there
as a concern.

I apologize for the negative tone of this mail. Don't get me wrong--I
use matplotlib and I like it b/c it's the best thing I've found.
However, I just had one of those "GAAARGHGGHHHH!" moments and it's
taking a little while to de-stress.

Cheers,
Greg

This is a consequence of how most of the interactive backends are implemented. Since matplotlib is using agg to render graphics for them, all updates to graphs mean a new image must be transmitted to the window. If it is a remote window, that update is going to cost. There may be ways of improving the backends so that not the whole window needs to be updated, but I have a feeling that isn't going to yield a big improvement in many cases (a new plot of points means changes over most of the image even if it can be characterized by a relatively small number of points and labels). I don't see any great solution to this (maybe John has some good ideas). I pointed this out as a consequence of going this way before it was done (and I recommended going this way :-). Implementing the backends using their built in plotting commands may be a way around this, but it means having much higher maintenance costs for backends and lots of annoying capability mismatches (some backends don't support rotated text, alpha blending, etc.)

Perry

ยทยทยท

On Feb 23, 2005, at 1:28 AM, Greg Novak wrote:

Gripe #3 is related to interactive windows when Python and the X11
server are connected by a slow link. All of the interactive backends
I've used for matplotlib look great, but render very slowly in this
situation b/c they're sending all the pixel data. Since most plots
consist of a few lines, a bit of text, and a few dots, it'd be nice if
the windows rendered quickly over slow connections. For example,
Gnuplot runs very well in this configuration. I realize that this
doesn't invovle matplotlib per se, I just wanted to throw it out there
as a concern.