You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TST: adapt colorbar tests to changes in matplotlib master #1962
Colorbars are now plotted differently, there is no collection on their axis anymore, causing this line (and same below) to fail on IndexError: list index out of range
is caused by reorganization of axes. So the label is now accessible as cax.child_axes[0].get_ylabel() instead of cax.get_ylabel(). Similarly, line 746 now needs to be cax.child_axes[0].get_xlabel().
The last failure is caused by the fact that the colorbar axis does not have the label passed in divider.append_axes, hence has no name. Can be rewritten using
The breaking change from matplotlib is that the axis we get from _get_colorbar_ax, the one with label "<colorbar>", is no longer the one directly containing the pcolormesh. This is now drawn in a inset axis of the latter. To fix the test, _get_colorbar_ax should return this inset axis, by looking in the children of the currently returned axis for an axis with label "inset_axes". I made a quick test and it seems to work.
Edit: well actually I now realize you had the solution in the remainder of your message, taking .child_axes[0], of which I ignored the existence, is simpler.
Activity
martinfleis commentedon Jul 5, 2021
Colorbars are now plotted differently, there is no collection on their axis anymore, causing this line (and same below) to fail on
IndexError: list index out of rangegeopandas/geopandas/tests/test_plotting.py
Line 247 in fc61364
I don't know how to get those colors anymore.
The second failure here
geopandas/geopandas/tests/test_plotting.py
Line 736 in fc61364
cax.child_axes[0].get_ylabel()instead ofcax.get_ylabel(). Similarly, line 746 now needs to becax.child_axes[0].get_xlabel().The last failure is caused by the fact that the colorbar axis does not have the label passed in
divider.append_axes, hence has no name. Can be rewritten usinggeopandas/geopandas/tests/test_plotting.py
Lines 1193 to 1194 in fc61364
I can fix the second and third issues now, I'd appreciate help with the first one if there's someone more familiar with matplotlib internals.
TLouf commentedon Jul 7, 2021
The breaking change from
matplotlibis that the axis we get from_get_colorbar_ax, the one with label "<colorbar>", is no longer the one directly containing thepcolormesh. This is now drawn in a inset axis of the latter. To fix the test,_get_colorbar_axshould return this inset axis, by looking in the children of the currently returned axis for an axis with label "inset_axes". I made a quick test and it seems to work.Edit: well actually I now realize you had the solution in the remainder of your message, taking
.child_axes[0], of which I ignored the existence, is simpler.martinfleis commentedon Jul 7, 2021
@TLouf would you like to turn it into a PR?
TLouf commentedon Jul 7, 2021
Yes no problem, I'm on it.
Zeroto521 commentedon Jul 8, 2021
Guys.
After matplotlib/matplotlib#20501 was merged, CI got fail again.
There were some new changes to the colorbar.