[SciPy-User] gnuplot.py xrange/shifting graph not working

nicky van foreest vanforeest at gmail.com
Sun Aug 2 16:06:42 EDT 2009


Hi,
> Here is a 3D version.
> ------------------
>
> #!/usr/bin/env python
>
> import Gnuplot
>
> g = Gnuplot.Gnuplot(debug=1)
> x = range(-3,4)
> data = []
>
> for i in x:
>     for j in x:
>         data.append([i, j, i*i])

I cannot help you right away this time. This is what I know:

I checked the demo.py file that comes along with python-gnuplot. There
the plotting starts with the z-values, then the x, and then the y
values: This is not what you seem to be doing.
See the line: g.splot(Gnuplot.GridData(m,x,y, binary=0))

Besides this, I recall from the not the frequently asked questions
site of gnuplot that interlacing spaces has some effect on the
plotting of data, which effect I forgot. This may also affect your
plot.

Sorry that I cannot be of further help this time.


>
> for i in data:
>     print i[0], i[1], i[2]
>
> g('set hidden3d')
> g('set style data linespoint')
> g.splot(data)
>
> ------------------
>
> the
>
>     g('set style data linespoint')
>
> leads to lines connecting that ought not to. To see what I mean run
> the above code, and then compare this with plotting the data below
> straight from gnuplot. It is the same as the program generates during
> the run, all I have done is inserted blank lines for each block and
> then saved the file under the name t2data
>
>
> ------------------
>
> gnuplot> set style data linespoint
> gnuplot> splot './t2data'
>
> ------------------
>
> Is there a way to mimic this with the data list? I tried appending '\n' to
> the data list, but that didn't work. If there is no easy work around I may
> just write the data to a file (with the blank lines) and then read it
> in again - probably not the most efficient way to do this, but it'll
> work :-) ... plus that seems to be going on in the background already
> anyway.
>
>
> Thanks,
> Esmail
>
>
> --- t2data file ----
> -3 -3 9
> -3 -2 9
> -3 -1 9
> -3 0 9
> -3 1 9
> -3 2 9
> -3 3 9
>
> -2 -3 4
> -2 -2 4
> -2 -1 4
> -2 0 4
> -2 1 4
> -2 2 4
> -2 3 4
>
> -1 -3 1
> -1 -2 1
> -1 -1 1
> -1 0 1
> -1 1 1
> -1 2 1
> -1 3 1
>
> 0 -3 0
> 0 -2 0
> 0 -1 0
> 0 0 0
> 0 1 0
> 0 2 0
> 0 3 0
>
> 1 -3 1
> 1 -2 1
> 1 -1 1
> 1 0 1
> 1 1 1
> 1 2 1
> 1 3 1
>
> 2 -3 4
> 2 -2 4
> 2 -1 4
> 2 0 4
> 2 1 4
> 2 2 4
> 2 3 4
>
> 3 -3 9
> 3 -2 9
> 3 -1 9
> 3 0 9
> 3 1 9
> 3 2 9
> 3 3 9
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list