Unsorted Float64Index gives clipped plots
See original GitHub issueCode Sample, a copy-pastable example if possible
import pandas as pd
df = pd.DataFrame({'y': [3.5, 4.5, 6.5]}, index=[2.5, 1.5, 3.5])
df.plot(style='o')
Problem description
This above may or may not be expected behaviour, but it did catch me by surprise: The range of the horizontal axis will be [2.5, 3.5], even though one of the data points has an index value outside that range.
Expected Output
Instead, I would have expected the output currently obtainable through df.sort_index().plot(style='o')
:
Output of pd.show_versions()
INSTALLED VERSIONS
commit: None python: 3.6.2.final.0 python-bits: 64 OS: Windows OS-release: 8.1 machine: AMD64 processor: Intel64 Family 6 Model 61 Stepping 4, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None
pandas: 0.20.3 pytest: 3.2.1 pip: 9.0.1 setuptools: 34.1.0 Cython: 0.26 numpy: 1.13.1 scipy: 0.19.1 xarray: None IPython: 6.1.0 sphinx: 1.6.2 patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.2 blosc: None bottleneck: 1.2.1 tables: 3.2.2 numexpr: 2.6.2 feather: None matplotlib: 2.0.2 openpyxl: 2.4.8 xlrd: 1.0.0 xlwt: 1.2.0 xlsxwriter: 0.9.8 lxml: 3.8.0 bs4: 4.6.0 html5lib: 0.9999999 sqlalchemy: 1.1.13 pymysql: None psycopg2: None jinja2: 2.9.6 s3fs: None pandas_gbq: None pandas_datareader: 0.5.0
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (6 by maintainers)
Top GitHub Comments
And thanks for looking into it; indeed, it looks like this one was a duplicate of #11471.
No problem @jreback Thanks for closing this, @TomAugspurger