Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.datemas.de!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'desired,': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'cc:addr:python-list': 0.10; 'explicitly': 0.15; '1),': 0.16; '>does': 0.16; '>to': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'did,': 0.16; 'did.': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'received:89.233': 0.16; 'received:89.233.217': 0.16; 'received:89.233.217.133': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'skip:> 20': 0.16; 'substitute': 0.16; 'utc,': 0.16; 'example.': 0.18; 'cc:addr:python.org': 0.21; 'cc:2**1': 0.22; 'produces': 0.22; 'code,': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; "doesn't": 0.28; 'this.': 0.28; 'matplotlib': 0.29; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'too.': 0.30; 'url:mailman': 0.31; 'code': 0.31; 'skip:d 20': 0.32; 'anybody': 0.32; 'url:python': 0.33; 'problem': 0.33; 'shift': 0.33; 'running': 0.34; 'url:listinfo': 0.35; 'skip:> 10': 0.35; 'but': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; 'charset :us-ascii': 0.37; 'instead': 0.38; 'skip:p 20': 0.38; 'does': 0.39; 'subject:-': 0.39; 'why': 0.40; 'forget': 0.60; 'your': 0.60; 'even': 0.61; 'times': 0.61; 'header:Message-Id:1': 0.62; '30,': 0.63; 'skip:n 10': 0.63; 'course': 0.64; 'different': 0.64; 'received:89': 0.80; '>if': 0.84; '>of': 0.84; 'back?': 0.84; 'pacific,': 0.84 To: Peter Pearson cc: python-list@python.org, lac@openend.se From: Laura Creighton Subject: Re: Matplotlib X-axis timezone trouble In-Reply-To: Message from Peter Pearson of "30 Jun 2015 00:56:26 +0000." References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20480.1435629837.1@fido> Content-Transfer-Encoding: quoted-printable Date: Tue, 30 Jun 2015 04:03:57 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [89.233.217.130]); Tue, 30 Jun 2015 04:04:02 +0200 (CEST) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435629849 news.xs4all.nl 2886 [2001:888:2000:d::a6]:38643 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:93307 In a message of 30 Jun 2015 00:56:26 +0000, Peter Pearson writes: >The following code produces a plot with a line running from (9:30, 0) to >(10:30, 1), not from (8:30, 0) to (9:30, 1) as I desire. > >If I use timezone None instead of pacific, the plot is as desired, but >of course that doesn't solve the general problem of which this is a >much-reduced example. > >If I use timezone US/Central, I get the same (bad) plot. > >import matplotlib.pyplot as plt >import datetime >import pytz >pacific =3D pytz.timezone("US/Pacific") >fig =3D plt.figure() >plt.plot([datetime.datetime(2014, 10, 7, 8, 30, tzinfo=3Dpacific), > datetime.datetime(2014, 10, 7, 9, 30, tzinfo=3Dpacific)], > [0,1], marker=3D"o", color=3D"green") >fig.autofmt_xdate() >plt.show() > >Does anybody know why this shift is occurring? Is Matplotlib >confused about what timezone to use in labeling the axis? How >would I tell it what timezone to use (preferably explicitly in >the code, not in matplotlibrc)? > >Thanks. > >-- = >To email me, substitute nowhere->runbox, invalid->com. >-- = >https://mail.python.org/mailman/listinfo/python-list I know that your problem is that all your times are in UTC, even though you do not want this. I had this too. I forget what I did. I do not know if this solution from stackoverflow.com will work for you -- it is definitely different from what I did, but that does not in any way make it wrong. Try and see? and report back? http://stackoverflow.com/questions/4485607/matplotlib-plot-date-keeping-ti= mes-in-utc-even-with-custom-timezone