Add the Box class for specifying the box of GMT embellishments#3995
Merged
Add the Box class for specifying the box of GMT embellishments#3995
Conversation
dd01578 to
d9ccd1f
Compare
7aa3bf8 to
37ed709
Compare
This was referenced Jul 26, 2025
Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
311c83f to
926a690
Compare
…iasSystem/params/base
Member
Author
|
@GenericMappingTools/pygmt-maintainers Please give this PR a high priority, since many PRs are waiting for it. |
weiji14
approved these changes
Sep 7, 2025
Member
weiji14
left a comment
There was a problem hiding this comment.
Looks good. Just two suggestions, one on ordering the docs, another one on making class BaseParam and AbstractBaseClass.
pygmt/params/base.py
Outdated
| """ | ||
|
|
||
|
|
||
| class BaseParam: |
Member
There was a problem hiding this comment.
Probably should make this an AbstractBaseClass (was debating between ABC or a Protocol).
Suggested change
| class BaseParam: | |
| from abc import ABC, abstractmethod, abstractproperty | |
| class BaseParam(ABC): |
Member
Author
There was a problem hiding this comment.
I've applied the suggestions but also made some changes in c6bd16f. The main changes are:
abstractpropertyis deprecated https://docs.python.org/3/library/abc.html#abc.abstractproperty. Now use@propertyand@abstractmethod.@abstractmethodmeans subclasses must implement the method/property, so theNotImplementedErroris not needed and can be removed.- The
_validatemethod is meant to be optional, so we can't use@abstractmethod. Then ruff reports theB027error, and it's ignored by adding thenoqaflag.
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
- abstractproperty is deprecated - _validate is optional, so we can't use @AbstractMethod - improve docstrings
weiji14
added a commit
that referenced
this pull request
Sep 16, 2025
5 tasks
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 implements the
Boxclass that can be used in modules likecoast/image/legend/colorbar/....The full GMT CLI syntax is (https://docs.generic-mapping-tools.org/6.6/colorbar.html#f):
The upstream long-form names are available at:
https://github.com/GenericMappingTools/gmt/blob/7026382558e11f89e2238bb345e1d0af325c12aa/src/longopt/psscale_inc.h#L35
The
Boxclass follows the upstream long-form names, but useinner_gap/inner_penfor+iandshade_offset/shade_fillfor+s.Preview: