-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
class ProcessPlotter(object):
def __init__(self):
self.index = False
self.columns = []
self.df = False
self._df = pd.DataFrame()
def terminate(self):
plt.close('all')
# HERE
# data sample
# {(4, 0): -0.009916651004225008, (4, 1): -1.0548021013814015e-07, (4, 3): -0.000925287713841344, (4, 5): -0.32002892931690496, (4, 6): -0.09059265200196842}
def _dataframe(self, data):
_datetime = dt.datetime.now().strftime('%H:%M:%S.%f')
_data = { _datetime: data}
_from_to = [k for k, v in data.items()]
_df = pd.DataFrame(_data, index=_from_to)
self._df = pd.concat([self._df, _df], axis=1)
print(self._df)
print(self._df.transpose())
return self._df.transpose()
def call_back(self):
while self.pipe.poll():
data = self.pipe.recv()
if data is None:
self.terminate()
return False
else:
# HERE switching subplots value
self._dataframe(data).plot(style='.', subplots=True, rot=45,
ax=self.ax, sharex=True, sharey=True)
self.fig.canvas.draw()
return True
def __call__(self, pipe):
self.pipe = pipe
self.fig, self.ax = plt.subplots(sharex=True, sharey=True)
timer = self.fig.canvas.new_timer(interval=1000)
timer.add_callback(self.call_back)
timer.start()
plt.subplots_adjust(bottom=0.1, top=1, left=0.1, right=1)
plt.legend()
plt.show()
Issue Description
df.plot(.., subplots=True, ..) everything is fine
df.plot(.., subplots=False, ..) duplicate labels, label colors changing every draw, not sharing the same x
Expected Behavior
A merge of all subplots using subplots=False
Installed Versions
INSTALLED VERSIONS
commit : 87cfe4e
python : 3.10.6.final.0
python-bits : 64
OS : Darwin
OS-release : 21.6.0
Version : Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG :
LOCALE :
pandas : 1.5.0
numpy : 1.23.3
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 63.4.3
pip : 22.2.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.0
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : 1.4.15
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : 2022.2