python - Running fig = plt.figure() in pandas opens two figures -
pretty says in title.. pandas examples suggest doing fig = plt.figure()
before df.plot(..)
. if that, 2 figures pop after plt.show()
- first empty , second actual pandas figure.. ideas why?
on dataframe, df.plot(..)
create new figure, unless provide axes object ax
keyword argument.
correct plt.figure()
not needed in case. plt.figure()
calls in pandas documentation should removed, indeed not needed. there issue this: https://github.com/pydata/pandas/issues/8776
what can ax
keyword eg:
fig, ax = plt.subplots() df.plot(..., ax=ax)
note when plotting series, default plot on 'current' axis (plt.gca()
) if don't provide ax
.
Comments
Post a Comment