-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CI: ax.rowNum and ax.colNum attributes deprecated in Matplotlib 3.2 #32444
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
Conversation
@WillAyd not sure about this. should we just be silencing the deprecation warnings instead. |
On a phone so haven’t looked deeply but does swapping out the attribute access for what the message says not work? |
it doesn't work on older versions. hopefully latest commit fixes but is more complex (may not be relevant). The alternative is silence the warnings and fix at a later date when the attributes have been deprecated. |
assuming our minimum supported version has 'SubplotSpec' object has attribute 'rowspan' by then. |
hmm, appears new matplotlib related errors on Linux py37_locale. |
right. fixed warnings in web and docs, but for some reason have two new test failures. have skipped so we can get to ci to green, raise an issue, and resolve independently |
@WillAyd I'm not happy with this but I think ok to merge. I think silencing the warnings may be a better approach, but sphinx is not my forte, so I leave that for others to investigate. |
@simonjayhawkins how about just capping matplotlib for now to get CI green then can come back to this at a deeper level (?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo.
And probably worth adding a test, since this only failed in the docs. The next code is what the docs have, calls the affected code and should generate the warning. I think it should be a test good enough (or if you prefer a unit test that calls _handle_shared_axes
that should be ok too):
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
ts = pd.Series(np.random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
df = pd.DataFrame(np.random.randn(1000, 4), index=ts.index, columns=list('ABCD'))
df = df.cumsum()
fig, axes = plt.subplots(4, 4, figsize=(6, 6))
plt.subplots_adjust(wspace=0.5, hspace=0.5)
target1 = [axes[0][0], axes[1][1], axes[2][2], axes[3][3]]
target2 = [axes[3][0], axes[2][1], axes[1][2], axes[0][3]]
df.plot(subplots=True, ax=target1, legend=False, sharex=False, sharey=False);
pandas/plotting/_matplotlib/tools.py
Outdated
@@ -288,20 +290,26 @@ def _remove_labels_from_axis(axis): | |||
|
|||
def _handle_shared_axes(axarr, nplots, naxes, nrows, ncols, sharex, sharey): | |||
if nplots > 1: | |||
if compat._mpl_ge_3_2_0(): | |||
row_num = lambda x: x.get_subplotspec().rowspan.start | |||
col_num = lambda x: x.get_subplotspec().rowspan.start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
col_num = lambda x: x.get_subplotspec().rowspan.start | |
col_num = lambda x: x.get_subplotspec().colspan.start |
nice catch. Thanks @datapythonista |
ok as a follow-up if this is green? |
Sure, the docs are being our tests already. Just thought that would be good to see this warning failing the tests. But happy to see the CI fixed asap. |
yeah, if this fails, will go with @WillAyd suggestion, #32444 (comment) |
…deprecated in Matplotlib 3.2
… in Matplotlib 3.2 (#32456) Co-authored-by: Simon Hawkins <[email protected]>
https://github.com/pandas-dev/pandas/pull/32442/checks?check_run_id=485569958