Hello - I just posted a few bugs (and patches to fix
> them) to the sourceforge bugtracker page before I
> realized that the email list is preferred.
More people see the list I think, but the SF mirror for the dev list
is generally woefully out of date, so it's a tossup.
> Short story: I found and (hopefully) fixed a problem with
> pcolor on non-square arrays, a startup error in the
> interactive.py shell, and a problem with repeated output
> when saving postscript backend figures. The details of
> the bugs and patches are copied below.
Thanks for the detailed information and patches!
> This happens because the shape of the X and Y arrays (the
> output of a meshgrid call on line 1782) have the wrong
> shape. In particular, the shape is backward. e.g. if
> C.shape = (x,y), then X.shape = Y.shape = (y, x).
The behavior of meshgrid certainly is a bit counter-intuitive. Eg, in
>> x = [1:7];
>> y = [1:5];
>> [X,Y] = meshgrid(x,y);
>> Z = rand(length(x), length(y));
??? Error using ==> surface
Matrix dimensions must agree.
matplotlib fails in the same way. I've updated the docs in meshgrid,
pcolor and fixed the meshgrid call in the case of pcolor(Z) for
I added the following to the pcolor docs - let me know if you agree
Note, the behavior of meshgrid in matlab is a bit
counterintuitive for x and y arrays. For example,
x = arange(7)
y = arange(5)
X, Y = meshgrid(x,y)
Z = rand( len(x), len(y))
pcolor(X, Y, Z)
will fail in matlab and matplotlib. You will probably be
pcolor(X, Y, transpose(Z))
Likewise, for nonsquare Z,
will make the x and y axes in the plot agree with the numrows
and numcols of Z
> Patch: Change matplotlib/axes.py line 1782 from: X, Y =
> meshgrid(range(numRows), range(numCols)) to: X, Y =
> meshgrid(range(numCols), range(numRows))
Fixed doc bug.
> Patch: Insert the command: interpreter.feed("from
> matplotlib.backends.backend_gtk import ShowOn") somewhere
> before line 206.
Fixed -- I don't know how this got removed.
> Patch: Insert the following lines at the end of the
> print_figure method of the FigurePS class in the file
> matplotlib/ backends/backend_ps.py (line 189):
> self._pswriter = StringIO()
Added a flush method, called by __init__ and after writing the figure.
Thanks again -- that was very helpful.