Skip to content

Line plot not autoscaled #17684

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
bfkeats opened this issue Sep 26, 2017 · 7 comments
Closed

Line plot not autoscaled #17684

bfkeats opened this issue Sep 26, 2017 · 7 comments
Labels

Comments

@bfkeats
Copy link

bfkeats commented Sep 26, 2017

dat.zip

edit: Attached the data to reproduce

import pandas as pd
import matplotlib.pyplot as plt
DF = pd.read_csv('dat.csv')
# Not autoscaled
DF.plot('x','y')
plt.show()
# Autoscaled
ax1 = DF.plot('x','y')
ax1.autoscale(True)
plt.show()
# Autoscaled
plt.plot(DF['x'],DF['y'])
plt.show()

Problem description

When I create a line plot with this particular dataset, the x-axis does not scale correctly.

Expected Output

The autoscaled plot.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.1.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.20.1
pytest: 3.0.7
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
xarray: None
IPython: 5.3.0
sphinx: 1.5.6
patsy: 0.4.1
dateutil: 2.6.0
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.7
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.3
bs4: 4.6.0
html5lib: 0.999
sqlalchemy: 1.1.9
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger
Copy link
Contributor

Can you provide a reproducible example?

@bfkeats
Copy link
Author

bfkeats commented Sep 26, 2017

Sorry, forgot to attached the csv. Added to original post.

@TomAugspurger
Copy link
Contributor

TomAugspurger commented Sep 26, 2017 via email

@bfkeats
Copy link
Author

bfkeats commented Sep 26, 2017

When I create a small dataframe, it autoscales fine. It has something to do with this particular data.

@sinhrks sinhrks added the Visualization plotting label Sep 27, 2017
@bfkeats
Copy link
Author

bfkeats commented Sep 27, 2017 via email

@nmartensen
Copy link
Contributor

This is fixed in v0.21.0.

Example code:

angles = np.arange(1, 11)/5. * np.pi
df = pd.DataFrame({'c': np.cos(angles), 's': np.sin(angles)})
df.plot(x='c', y='s')

old output:
pandas_old

new output:
pandas_new

@TomAugspurger
Copy link
Contributor

Thanks, closed by #16600.

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

No branches or pull requests

4 participants