Description
Code Sample, a copy-pastable example if possible
x = [1,2,3]
y = [4,3,5]
plt.plot(x,y,marker='o'); # x-limits are extended
pd.Series(y, index=x).plot(marker='o'); # x-limits are exactly on the first/last points
Problem description
When the data is plotted using Series.plot()
, the x-limits are set on the exactly first and last points of the set. This is different from the behavior of matplotlib's plot, where it gives a bit more space.
pandas: 0.25.1
matplotlib: 3.0.1
INSTALLED VERSIONS
commit : None
python : 3.7.1.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.1
numpy : 1.16.4
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.3
setuptools : 41.4.0
Cython : None
pytest : 5.2.0
hypothesis : None
sphinx : 2.2.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : None
pymysql : 0.9.3
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.1.1
pandas_datareader: None
bs4 : 4.6.3
bottleneck : None
fastparquet : 0.1.6
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.0.1
numexpr : 2.7.0
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.15.0
pytables : None
s3fs : 0.3.4
scipy : 1.3.1
sqlalchemy : 1.3.8
tables : 3.4.4
xarray : None
xlrd : 1.1.0
xlwt : None
xlsxwriter : None