Skip to content

Missing spaces between lines and y-axis #27796

Closed
@arthurire

Description

@arthurire

Code Sample, a copy-pastable example if possible

import pandas as pd
import matplotlib.pyplot as plt
plt.plot([1,2],[2,4])
pd.DataFrame([2,4],index=[1,2]).plot()

image
image

Problem description

Plots generated by df.plot() and plt.plot() are different and I expected them exactly the same.

As you can see, all the spaces between y-axis and lines are missing when I use pd.DataFrame.plot().

When you have a large dataset and there's a rapid change at the end, the change might be covered by the border, makes the plot hard to read.

image

image

pandas version:0.25.0
matplotlib version:3.1.1

Latest version that works:
pandas:0.23.x
matplotlib 3.0.3

Expected Output

Two figures should look exactly the same.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Darwin
OS-release : 18.6.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : zh_CN.UTF-8
LOCALE : zh_CN.UTF-8

pandas : 0.25.0
numpy : 1.17.0
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.1
setuptools : 41.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.7.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions