2d color-bar map plot

Peter Pearson pkpearson at nowhere.invalid
Fri Oct 17 11:51:21 EDT 2014


On Fri, 17 Oct 2014 14:28:13 +0800, Dhananjay wrote:
[snip]
> xs = ys = zs = []
> for line in fl1:
>     line = line.split()
>     xs.append(float(line[0]))
>     ys.append(float(line[1]))
>     zs.append(float(line[2]))
>
> print xs[0], ys[0], zs[0]

The line "xs = ys = zs = []" is almost surely not what you want to do.
It results in xs, ys, and zs all being the same object.  Look:

    >>> xs = ys = zs = []
    >>> xs.append(1)
    >>> print(ys)
    [1]
    >>> 

Since your xs, ys, and zs are all identical, some unfortunate part
of the plotting package is trying in vain to find some thickness to
the thing it's plotting, but it can't, because all the points you've
given it lie on the x=y=z plane.  (It's sad that it tries so heroically
to give a detailed error message that turns out to be so obscure.)

So spend a few more characters:
    xs = []
    ys = []
    zs = []

Then, on to the next problem.

-- 
To email me, substitute nowhere->runbox, invalid->com.



More information about the Python-list mailing list