2d color-bar map plot
Peter Pearson
pkpearson at nowhere.invalid
Fri Oct 17 11:51:21 EDT 2014
More information about the Python-list mailing list
Fri Oct 17 11:51:21 EDT 2014
- Previous message (by thread): 2d color-bar map plot
- Next message (by thread): 2d color-bar map plot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Previous message (by thread): 2d color-bar map plot
- Next message (by thread): 2d color-bar map plot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list