Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79245

Re: 2d color-bar map plot

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Peter Pearson <pkpearson@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: 2d color-bar map plot
Date 17 Oct 2014 15:51:21 GMT
Lines 35
Message-ID <cacs7pFk8lsU1@mid.individual.net> (permalink)
References <mailman.14939.1413527301.18130.python-list@python.org>
X-Trace individual.net e0Tvyf8k8yd3EC5zRaWfJwkHSglpsdtnF5KbSlqB3b63Wfd9LR
Cancel-Lock sha1:CxplVAjtBV/Tktl3orUUbnxwLlU=
User-Agent slrn/pre1.0.0-18 (Linux)
Xref csiph.com comp.lang.python:79245

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

2d color-bar map plot Dhananjay <dhananjay.c.joshi@gmail.com> - 2014-10-17 14:28 +0800
  Re: 2d color-bar map plot Peter Pearson <pkpearson@nowhere.invalid> - 2014-10-17 15:51 +0000

csiph-web