Python-GnuPlot : Plotting problems

John J. Lee phrxy at csv.warwick.ac.uk
Mon Jun 4 11:50:21 EDT 2001


On 2 Jun 2001, Prem Rachakonda wrote:
[...]
> 1. I have a set of z values in a matrix of [5000,100] from which I
> have to get the contour of a surface and the lenghts of x and y are
> 5000 and 100.
> If I try to plot by using the following function, I am not getting the
> contour
>
>  g.splot(Gnuplot.GridData(z,x,y, binary=0))

What *do* you get?  And what do you mean by 'the' contour?  You can set
the number of contours (and probably the contour levels as well) by
sending a command to Gnuplot directly, I think, if that's what you want:

g("set cntrparam levels 10")  # command sent directly to Gnuplot

I'm not sure what your x and y are, but try:

x = arange(z.shape[0]); y = arange(z.shape[1])

followed by the splot command you give above.

> I tried to use only one set of values ie. The sizes of matrices are
> given below
>  z[5000,1]
>  x[5000]
>  y[1]
>
> This gave me a perfect profile of the contour( It extends in the y
> direction)
>
> When I went for 2 sets of values, ie. z[5000,2], x[5000], y[2] then I
> get 4 plots of the contours
>
> 1st two plots are in the x-z plane (at y[1]), the first one from x[0]
> to x[2500] and the other from x[2501] to x[5000]
>
> 2nd two plots are a mirror of the above 2 plots but at y[2]
>
> This is absolutely out of my understanding. Can someone explain why
> this is happening.

Hmm, this kind of thing is painful to describe in flat ASCII, isn't it?
I'm not sure exactly what you're getting / expecting.

> 2.Also how to issue command to Gnuplot. I want to change the view of a
> plot and the Gnuplot's way it to say 'set view 90,0'.How to issue
> command from Python to execute this command.

g.("set view 90,0")


John




More information about the Python-list mailing list