Summary
Several pyplot functions with familiar Matplotlib getter/setter contracts are implemented only as setters returning None. Most seriously, calling plt.xlim() or plt.ylim() with no arguments mutates the axes by freezing the current automatic domain as explicit. The wrappers also document keyword forms they do not accept. Tick getters are absent, and plt.legend() is annotated as returning None while returning a live Legend object.
Audited at 99eda6d.
Current behavior
plt.xlim and plt.ylim accept only *args, always call setters, and return None in python/xy/pyplot/__init__.py. Their docstrings advertise left=/right= forms that the wrappers reject.
With no arguments, Axes.set_xlim() reads the automatic range and writes it back as an explicit domain in python/xy/pyplot/_axes.py. Thus a getter-looking call changes later autoscaling behavior.
plt.xticks() and plt.yticks() also always call their setters and return None in pyplot/__init__.py, instead of returning the current locations and labels when called without arguments.
Finally, plt.legend() is annotated -> None while directly returning gca().legend(...) in pyplot/__init__.py.
Proposed direction
Implement explicit getter and setter branches with overloads, and align the exposed Axes setter return values where the shim claims Matplotlib compatibility. Getter branches must be observational: they cannot add explicit domains, replace locators/formatters, or invalidate the figure.
Acceptance criteria
Summary
Several pyplot functions with familiar Matplotlib getter/setter contracts are implemented only as setters returning
None. Most seriously, callingplt.xlim()orplt.ylim()with no arguments mutates the axes by freezing the current automatic domain as explicit. The wrappers also document keyword forms they do not accept. Tick getters are absent, andplt.legend()is annotated as returningNonewhile returning a liveLegendobject.Audited at
99eda6d.Current behavior
plt.xlimandplt.ylimaccept only*args, always call setters, and returnNoneinpython/xy/pyplot/__init__.py. Their docstrings advertiseleft=/right=forms that the wrappers reject.With no arguments,
Axes.set_xlim()reads the automatic range and writes it back as an explicit domain inpython/xy/pyplot/_axes.py. Thus a getter-looking call changes later autoscaling behavior.plt.xticks()andplt.yticks()also always call their setters and returnNoneinpyplot/__init__.py, instead of returning the current locations and labels when called without arguments.Finally,
plt.legend()is annotated-> Nonewhile directly returninggca().legend(...)inpyplot/__init__.py.Proposed direction
Implement explicit getter and setter branches with overloads, and align the exposed
Axessetter return values where the shim claims Matplotlib compatibility. Getter branches must be observational: they cannot add explicit domains, replace locators/formatters, or invalidate the figure.Acceptance criteria
plt.xlim()andplt.ylim()return the current limits without changing autoscale/explicit-domain state.plt.xticks()andplt.yticks()getter forms return current locations and label handles/objects within the documented compatibility scope without mutating tick state.plt.legend()has the correct return annotation and returns the live legend handle.