Skip to content

Plotting: series.plot() has different x-limits than plt.plot() #28953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vfilimonov opened this issue Oct 13, 2019 · 3 comments
Closed

Plotting: series.plot() has different x-limits than plt.plot() #28953

vfilimonov opened this issue Oct 13, 2019 · 3 comments

Comments

@vfilimonov
Copy link
Contributor

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

image

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

@rohitsanj
Copy link
Contributor

@vfilimonov This seems to be fixed on the pandas dev version 0.26.0.dev0+557.g0eee324c2

@vfilimonov
Copy link
Contributor Author

@rohitsanj Great to hear!
Sorry for not checking the dev before reporting.

@mroeschke
Copy link
Member

Closed by #27993

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants