Skip to content

BUG: Series.plot x-axis labels are off by one year when a timezone is involved #15754

@dadkins

Description

@dadkins
%matplotlib inline import numpy as np import pandas as pd import matplotlib.pyplot as plt pd.show_versions() index = np.array([ '2011-10-01 09:00', '2016-10-01 09:00', ], dtype='datetime64[ns]') values = np.array([ -0.26, -0.01, ]) data_utc = pd.Series(values, index) data_utc.index = data_utc.index.tz_localize('UTC') data_eastern = pd.Series(values, index) data_eastern.index = data_eastern.index.tz_localize('UTC').tz_convert('US/Eastern') data_utc.plot(title='UTC') plt.figure() data_eastern.plot(title='US/Eastern') plt.figure()

With the Eastern time zone, the x-axis labels are off by a year.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.13.final.0 python-bits: 64 OS: Linux OS-release: 3.10.0-229.4.2.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: C LOCALE: None.None

pandas: 0.19.2
nose: None
pip: 9.0.1
setuptools: 27.2.0
Cython: None
numpy: 1.12.0
scipy: None
statsmodels: None
xarray: None
IPython: 5.3.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 2.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.5
boto: None
pandas_datareader: None

image
image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions