Closed
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
ax = (pd.DataFrame(np.random.randn(100, 2), columns=['A','B'])
.plot.scatter(
x='A',
y='B',
xlabel='my x label',
ylabel='my y label',
)
)
Problem description
In #34223 (released in 1.1.0), the ability to set xlabel
and ylabel
in DataFrame.plot()
was added. This works fine when calling plot()
directly or df.plot.line()
. When calling df.plot.scatter()
with these args, you still get the index labels as the axis labels, instead of the strings you pass in.
These args are not documented to be incompatible or unavailable on this function, and no error is printed.
Expected Output
The plot's axis labels should be the strings provided, "my x label" and "my y label".
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit : db08276bc116c438d3fdee492026f8223584c477
python : 3.8.5.final.0
python-bits : 64
OS : Darwin
OS-release : 19.6.0
Version : Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 1.1.3
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 50.3.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 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : 0.8.7
xarray : None
xlrd : None
xlwt : None
numba : None