Implement the Perspective class for specifying viewpoint - #4201
Open
seisman wants to merge 19 commits into
Open
Conversation
This was referenced Nov 12, 2025
seisman
marked this pull request as ready for review
June 25, 2026 14:44
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new class-style parameter, pygmt.params.Perspective, to represent GMT’s -p perspective option in a more structured way, and wires it into the public plotting API and documentation.
Changes:
- Added
Perspective(pygmt/params/perspective.py) plus unit tests to validate its string serialization and error handling. - Updated many plotting wrappers’
perspectivetype annotations/imports to accept aPerspectiveobject. - Updated parameter documentation and the API docs index to include
Perspective.
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pygmt/tests/test_params_perspective.py | Adds tests for Perspective string formatting and invalid plane handling. |
| pygmt/src/wiggle.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/vlines.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/velo.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/tilemap.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/text.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/ternary.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/solar.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/scalebar.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/rose.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/plot3d.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/plot.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/meca.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/magnetic_rose.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/logo.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/legend.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/image.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/hlines.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/histogram.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/grdview.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/grdimage.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/grdcontour.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/fill_between.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/directional_rose.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/contour.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/colorbar.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/coast.py | Updates perspective type annotation to accept Perspective. |
| pygmt/src/basemap.py | Updates perspective type annotation to accept Perspective. |
| pygmt/params/perspective.py | Implements the new Perspective parameter class. |
| pygmt/params/init.py | Exposes Perspective from pygmt.params. |
| pygmt/helpers/decorators.py | Updates the shared perspective parameter docstring text. |
| doc/api/index.rst | Adds Perspective to the “Class-style Parameters” API docs list. |
💡 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.
Implement the Perspective class for the
-poption. See #4176 for related discussions.Notes:
levelis used rather thanzlevel, because strictly speaking it can set the level for x-, y-, or z-planes.+w/+vare not implemented yet, but they're mainly for animations so not frequently used.Preview: