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


Groups > comp.lang.python > #18020

Re: Plot seems weird

From Lie Ryan <lie.1296@gmail.com>
Subject Re: Plot seems weird
Date 2011-12-27 21:54 +1100
References (2 earlier) <4f709686-4b07-4096-a87c-3e4bf8571c73@v13g2000yqc.googlegroups.com> <mailman.4099.1324891710.27778.python-list@python.org> <74f9b578-ab36-4962-a353-ec52fe5ba12e@cs7g2000vbb.googlegroups.com> <mailman.4104.1324925950.27778.python-list@python.org> <96ac870e-dffe-4556-aa3a-fab84333ceda@o9g2000vbc.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4131.1324983314.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 12/27/2011 06:14 AM, Yigit Turgut wrote:
> On Dec 26, 8:58 pm, Lie Ryan<lie.1...@gmail.com>  wrote:
>> On 12/27/2011 04:08 AM, Yigit Turgut wrote:
>>
>> not your fault, I made a mistake when copy-pasteing the code, here's the
>> fixed code:
>>
>> from itertools import izip_longest
>> def to_square(data):
>>        sq_data = [[], []]
>>        for x,y, xn in izip_longest(data[0], data[1], data[0][1:]):
>>            sq_data[0].append(x)
>>            sq_data[1].append(y)
>>            sq_data[0].append(xn)
>>            sq_data[1].append(y)
>>        return numpy.array(sq_data, dtype=float)
>>
>> use it like this:
>>
>> t,y1 = to_square(numpy.genfromtxt(filename, unpack=True))
>> pyplot.plot(t,y1)
>> pyplot.show()
>
> Significant improvement on the plot, pretty interesting. It runs ok
> but I need to know how?! (:

it's pretty simple, actually; just observe the numbers before and after 
it's fixed by the function and it should be fairly obvious.

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


Thread

Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-25 07:33 -0800
  Re: Plot seems weird Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-25 09:06 -0800
    Re: Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-25 10:27 -0800
      Re: Plot seems weird Lie Ryan <lie.1296@gmail.com> - 2011-12-26 20:28 +1100
        Re: Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-26 09:08 -0800
          Re: Plot seems weird Lie Ryan <lie.1296@gmail.com> - 2011-12-27 05:58 +1100
            Re: Plot seems weird Yigit Turgut <y.turgut@gmail.com> - 2011-12-26 11:14 -0800
              Re: Plot seems weird Lie Ryan <lie.1296@gmail.com> - 2011-12-27 21:54 +1100

csiph-web