Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'am,': 0.12; 'def': 0.13; '[[],': 0.16; 'obvious.': 0.16; 'this:': 0.16; 'wrote:': 0.18; 'interesting.': 0.18; 'ryan': 0.18; 'dec': 0.22; 'header:In-Reply- To:1': 0.22; 'runs': 0.23; 'function': 0.27; 'import': 0.27; 'code,': 0.27; 'fixed': 0.29; 'pm,': 0.29; 'fairly': 0.30; 'observe': 0.30; 'pretty': 0.32; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'to:addr:python-list': 0.34; 'lie': 0.34; 'received:au': 0.36; 'but': 0.37; 'received:org': 0.38; 'should': 0.39; "it's": 0.40; 'to:addr:python.org': 0.40; 'your': 0.61; 'simple,': 0.64; '26,': 0.67; '04:08': 0.84; 'fault,': 0.84; 'received:110': 0.95 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Lie Ryan Subject: Re: Plot seems weird Date: Tue, 27 Dec 2011 21:54:57 +1100 References: <880a2ed3-1a3f-45e7-b439-e87289403fd9@t16g2000vba.googlegroups.com> <4f709686-4b07-4096-a87c-3e4bf8571c73@v13g2000yqc.googlegroups.com> <74f9b578-ab36-4962-a353-ec52fe5ba12e@cs7g2000vbb.googlegroups.com> <96ac870e-dffe-4556-aa3a-fab84333ceda@o9g2000vbc.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 110-175-240-90.static.tpgi.com.au User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0 In-Reply-To: <96ac870e-dffe-4556-aa3a-fab84333ceda@o9g2000vbc.googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1324983314 news.xs4all.nl 6879 [2001:888:2000:d::a6]:51389 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18020 On 12/27/2011 06:14 AM, Yigit Turgut wrote: > On Dec 26, 8:58 pm, Lie Ryan 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.