# [SciPy-user] Simple plot problem

Guilherme P. de Freitas guilherme@gpfreitas....
Tue Feb 17 04:56:08 CST 2009

```Hi again, Gael. I forgot to comment on the documentation.

> I would interested in figuring out what posed problem in the
> documentation, and how things could be improved. The trick is to create
> arrays to evaluate the functions on: x and y. For a surface, you need to
> create a 2D array, in other words a grid of x and y varying in the 2
> directions. This is what the mgrid function does. Maybe a note about
> mgrid in the documentation relative to plotting surface could help?

The use of mgrid was not the puzzle. The puzzle was why I got the
shrinked object in the plot3d. As for the documentation, it would be
nice in the documentation of the plot3d function to have specified
what is a valid input. As far as I know, here's the official
documentation of the mlab.plot3d function:

http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/mlab_helper_functions.html#plot3d

And it just says "Draws lines between points". I think something
like "x, y and z must be arrays of the same shape" would help a lot.
I figured that out by trial and error (the error messages are
informative), but it took a while, and given that I had a problem, I
thought I was doing something wrong (I'm still not sure, because I
still have the "shrinking" problem), and the documentation did not
help in figuring out what was wrong.

In part the documentation did not help be because a specification of
valid input was not available, but also in part because there isn't
a single *simple* example of Mlab worked out. I suppose plotting
simple (x,y) |-> z function is probably not the intended use of
Mlab, but given the lack of other 3d plotting alternatives in
Python, it can be very useful.

--
Guilherme P. de Freitas
http://www.gpfreitas.com
```