Figure.histogram: Migrate the parameter horizontal to the new alias system - #4880
Open
seisman wants to merge 2 commits into
Open
Figure.histogram: Migrate the parameter horizontal to the new alias system#4880seisman wants to merge 2 commits into
seisman wants to merge 2 commits into
Conversation
seisman
marked this pull request as ready for review
September 4, 2026 16:52
37 tasks
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new horizontal parameter is inserted mid-signature in a way that can break existing positional-argument calls, and the migrated behavior lacks a targeted regression test.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Migrates Figure.histogram’s horizontal (-A) handling from the legacy @use_alias mapping to the newer AliasSystem mechanism, aligning this option with the newer argument-building pathway used across PyGMT.
Changes:
- Remove
A="horizontal"from the@use_aliasdecorator. - Add an explicit
horizontalparameter to thehistogramsignature and wire it to-AviaAliasSystem. - Document
A = horizontalin the$aliasessection.
File summaries
| File | Description |
|---|---|
| pygmt/src/histogram.py | Moves horizontal/-A from legacy alias mapping into AliasSystem and exposes it explicitly in the function signature. |
Review details
Suppressed comments (1)
pygmt/src/histogram.py:52
- Adding the new
horizontalparameter in the middle of the positional-or-keyword signature changes the positional argument ordering (e.g., existing code passingprojectionpositionally would now bind tohorizontal). To avoid an unintended breaking API change, consider movinghorizontalto the end of the signature (just before**kwargs) so all existing positional arguments keep their meaning.
pen: str | None = None,
fill: str | None = None,
horizontal: bool = False,
projection: str | None = None,
region: Sequence[float | str] | str | None = None,
frame: Frame | Axis | Literal["none"] | str | Sequence[str] | bool = False,
verbose: Literal["quiet", "error", "warning", "timing", "info", "compat", "debug"]
| bool = False,
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates the parameter
horizontal(-A) to the new alias system.In matplotlib,plt.histprovides theorientationparameter, which can be"vertical"and "horizontal" (xref: https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html). I wonder if we should use the same parameter name, but it means we need to deprecatehorizontaltoorientation.Edit: Personally I prefer
horizontal=Truewhich is simpler.