Skip to content
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

Title overlaps subplot #29459

Open
thehalftruth opened this issue Nov 7, 2019 · 3 comments
Open

Title overlaps subplot #29459

thehalftruth opened this issue Nov 7, 2019 · 3 comments
Labels

Comments

@thehalftruth
Copy link

Code Sample

import pandas as pd
import matplotlib.pyplot as plt
from io import StringIO

csv_string = """x,y1,y2
0, 1, 1
1, 1, 2
2, 1, 3
3, 4, 2
4, 2, 4
5, 3, 3
"""

data = pd.read_csv(StringIO(csv_string))
dataframe = pd.DataFrame(data)

dataframe.plot(x="x",
               y=["y1", "y2"],
               kind="line",
               subplots=True,
               sharex=True,
               marker=",",
               linewidth=0.5,
               title="Title"
               )

plt.show()

Problem description

The title overlaps the subplot:
grafik
Also the xticks should not be rotated, but I will create a new issue for that.

Expected Output

The title shouldn't overlap the subplot.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : None python : 3.7.2.final.0 python-bits : 32 OS : Windows OS-release : 10 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : None.None

pandas : 0.25.3
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 41.6.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
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
import sys; print('Python %s on %s' % (sys.version, sys.platform))
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32

@jbrockmendel jbrockmendel added the Visualization plotting label Nov 7, 2019
@wesbarnett
Copy link

When I plot with your example the Title is above the plot (but numbers still rotated). The Title actually looks a little too far up in my case.

Figure_1

pd.show_versions() INSTALLED VERSIONS ------------------ commit : None python : 3.7.4.final.0 python-bits : 64 OS : Darwin OS-release : 18.7.0 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8

pandas : 0.25.1
numpy : 1.17.2
pytz : 2019.2
dateutil : 2.8.0
pip : 19.3
setuptools : 41.2.0
Cython : 0.29.13
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.3 (dt dec pq3 ext lo64)
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : 4.8.0
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 : 1.3.1
sqlalchemy : 1.3.8
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None

@thehalftruth
Copy link
Author

Interesting. I tried it at my machine at home and I get the same result (title above to subplot). At work I use the scientific view of pycharm pro but this shouldn't change the output. I will try on monday if I get a different output when I turn off the scientific view.

@thehalftruth
Copy link
Author

I tried it with again with pycharm pro and it's a problem with the scientific view. If it's on then the title is over the line, when it's off then the title is too high.

@mroeschke mroeschke added the Bug label Jul 22, 2021
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