Closed
Description
You can't see anything in the ax1 plot.
import pylab
import pandas as pd
pylab.ion(); pylab.show()
idx1 = pd.date_range('2015-01-01', periods=3, freq='1M')
idx2 = idx1[:1] + idx1[2:]
series1 = pd.Series(range(len(idx1)), idx1)
series2 = pd.Series(range(len(idx2)), idx2)
# this doesn't work
pylab.figure()
ax1 = pylab.subplot(211)
series1.plot(ax=ax1)
ax2 = pylab.subplot(212, sharex=ax1)
series2.plot(ax=ax2)
# this works
pylab.figure()
ax3 = pylab.subplot(211)
pylab.plot(series1.index, series1.values)
ax4 = pylab.subplot(212, sharex=ax3)
pylab.plot(series2.index, series2.values)
Issue seems to be with how its converting xdata
for ax in (ax1, ax2, ax3, ax4):
print(ax.get_lines()[0].get_xdata())
[Period('2015-01', 'M') Period('2015-02', 'M') Period('2015-03', 'M')]
[datetime.datetime(2015, 1, 31, 0, 0) datetime.datetime(2015, 3, 31, 0, 0)]
['2015-01-31T00:00:00.000000000+0000' '2015-02-28T00:00:00.000000000+0000'
'2015-03-31T00:00:00.000000000+0000']
['2015-01-31T00:00:00.000000000+0000' '2015-03-31T00:00:00.000000000+0000']
str(ax2.get_xticklabels()[0])
"Text(735636,0,'63273')"
str(ax4.get_xticklabels()[0])
"Text(735630,0,'Feb 01 2015')"
INSTALLED VERSIONS
------------------
commit: None
python: 3.4.4.final.0
python-bits: 64
OS: Linux
OS-release: 3.14.32-pv-ts1
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.18.0
nose: None
pip: 8.1.1
setuptools: 20.7.0
Cython: 0.24
numpy: 1.10.4
scipy: 0.17.0
statsmodels: 0.6.1
xarray: None
IPython: 4.2.0
sphinx: 1.4.1
patsy: 0.4.1
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: 1.0.0
tables: 3.2.2
numexpr: 2.5.2
matplotlib: 1.5.1
openpyxl: 2.3.2
xlrd: 0.9.4
xlwt: None
xlsxwriter: 0.8.5
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.12
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None