Figure.image: Add parameter fgcolor/bgcolor/transparent_color and deprecate bitcolor [Will be removed in 0.24.0] - #4872
Merged
Merged
Conversation
…recate bitcolor [Will be removed in 0.24.0]
This was referenced Aug 30, 2026
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A new user-facing parameter (transparent_color) is added without a positive (non-error) regression test to validate the intended -G+t output behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds support for GMT’s image -G behavior in pygmt.Figure.image by introducing explicit parameters for foreground/background/transparent colors while keeping the older bitcolor interface available under deprecation.
Changes:
- Add
bgcolor,fgcolor, andtransparent_colorparameters toFigure.image, and deprecatebitcolorwith warnings + conflict validation. - Add image-comparison tests and baseline for
bgcolor/fgcolor, plus validation tests for invalid inputs and deprecated-parameter interactions. - Cache the new sample dataset (
@vader1.png) used by the new test.
File summaries
| File | Description |
|---|---|
| pygmt/src/image.py | Implements -G via bgcolor/fgcolor/transparent_color and deprecates bitcolor with validation + alias mapping. |
| pygmt/tests/test_image.py | Adds mpl baseline test for bgcolor/fgcolor and new validation/deprecation tests. |
| pygmt/tests/baseline/test_image_bgcolor_fgcolor.png | New baseline image for the bgcolor/fgcolor mpl comparison test (LFS). |
| pygmt/helpers/caching.py | Adds @vader1.png to cached datasets to support tests. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- 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.
Implement the
-Goption, as three separate parametersfgcolor/bgcolor/transparent_color, as proposed in #4263 (comment).Supersedes #4280
Related to #4263.