# [SciPy-user] Simple plot problem

Ralf Ahlbrink Ralf_Ahlbrink@web...
Tue Feb 17 03:38:58 CST 2009

```Am Dienstag, 17. Februar 2009 schrieb Guilherme P. de Freitas:
> Hi everybody,
>
> I'm running Python 2.5.2 with EPD with Py2.5 4.0.30002
>
> I need to plot three simpe things, in 3d, domain is x, y in [0,3] x
> [0,3:
>
> 1. the graph of the function f(x,y) = x**(0.3) * y**(0.7)
> 2. the parametric straight line (x, 2 - 2*x, 0)  for x in [0,1]
> 3. the parametric curve (x, 2 - 2*x, f(x, 2 - 2*x))
>
>
> - I thought of matplotlib, mlab (from mayavi2), SymPy and PyX.
>
> - Apparently matplotlib cannot do 3d plots. Is this correct? My
>   version of matplotlib is 0.98.
>
> - I could not plot 2 (the parametric line) with mlab. I am not sure
>   I understood the syntax of mlab.plot3d, and the examples
>   everywhere are too complicated for me to understand how it works.
>   I tried "mlab.plot3d([0, 1], [2, 0], [0, 0])" and it gave me a
>   short line, very small, that was in the interior of the positive
>   quadrant of the xy plane. Imagine the line I wanted and shrink it
>   80% to its midpoint, that's what I got.
>
> - I tried SymPy. I could plot everything easily. However, I could
>   not change thickness and color of curves. Didn't find anything in
>   the documentation. Any ideas? By the way, setting colors of
>   objects in both SymPy and Mlab seems to complicated for simple
>   use. How do I make the object red, for example?
>
> - PyX apparently has no 3d plotting capabilities. Is this correct?
>
>
> I could not find an example of a simple plot of a function f : R^2
> -> R in any python tool, with explanations of how to change
> thickness, color, style and labels of plots. Ideally, labels should
> be rendered with TeX. There were all sorts of complicated examples,
> but nothing simple like what I needed. And no example simple enough
> that I could really understand what was going on for all the
> commands I needed. I will gladly write a short tutorial about it if
> there is a way to do this and I find out the solution.
>
> Now I will try GnuPlot, and if that does not work, Maple. But I'd
> like to do it with Python. Any help is appreciated.
>
> Thanks,

Hi!

You could use Mayavi (see Enthought site) for interactive 3D plotting, e.g.

and in this session:

In [1]: from enthought.mayavi import mlab

See
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html#simple-
scripting-with-mlab for examples.

Regards,
Ralf.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20090217/e8be1c1e/attachment.html
```