Fix PolarAxes.format() silently dropping xlabel/ylabel#713
Conversation
|
Out of town atm can look at this when I'm back. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
My initial read on this was that xlabel and ylable makes no sense for |
|
If yes then my issue would be that Taylor diagrams probably need a new axis type as it does not make sense to have x and y labels for polar axes (as they don't exist). |
|
Yeah, I agree. I should not have included this in the same PR. I originally started from xlabel/ylabel and realized later rlabel/thetalabel make more sense. So, I am okay dropping this. I think we can suggest to use rlabel/thetalabel if users pass xlabel/ylabel. |
Summary
ax.format(xlabel=..., ylabel=...)had no effect on polar axes (e.g. for Taylor-diagram-style figures), even thoughax.set_xlabel(...)worked.PolarAxes.format()did not declarexlabel/ylabelparameters andbase.Axes.format()does not handle them — onlyCartesianAxes.format()did.This PR:
_update_labelshelper toPolarAxesmirroring theCartesianAxesone, and wiresxlabel,ylabel,xlabel_kw,ylabel_kwthrough the existing(x, y)loop so they are forwarded to matplotlib'sset_xlabel/set_ylabel.Figure.format()exposed by the change:_pop_paramspreviously popped each kwarg into the first matching class signature, so when called viaSubplotGrid.format→Figure.formaton a polar axes,xlabelwas routed tokws[CartesianAxes]and never applied. Switched to a non-popping collector so shared params reach every matching class signature; the unused-warning is updated so shared keys consumed by any matched class don't trigger a false warning.test_projections.py.Test plan
pytest ultraplot/tests/test_projections.py -k polar— new and existing polar tests passpytest ultraplot/tests/test_format.py— no regressionstest_docs_fetch_releases)ax.format(xlabel='Radius', ylabel='Angle', labelpad=15, labelcolor='red', xlabel_kw={'weight': 'bold'})renders correctly with per-axis-kw override