Skip to content

Figure.coast: Migrate the rivers parameter to the new alias system and improve docstrings - #4242

Merged
seisman merged 4 commits into
mainfrom
coast/rivers
Dec 8, 2025
Merged

seisman merged 4 commits into
mainfrom
coast/rivers

Conversation

@seisman

@seisman seisman commented Dec 4, 2025 •

Copy link
Copy Markdown
Member

This PR migrates Figure.coast's rivers parameter to the new alias system.

I also try my best to improve the docstrings to make them more readable.

Preview: https://pygmt-dev--4242.org.readthedocs.build/en/4242/api/generated/pygmt.Figure.coast.html#pygmt.Figure.coast

rivers can accept values in different formats, e.g, :

  • rivers=1
  • rivers=[1, 3, 5]
  • rivers="1/1p,blue"
  • rivers=["1/1p,blue", "2/2p,red"]

For the last two cases, perhaps it's more Pythonic to pass a dictionary like: rivers = {1: "1p,blue", 2: "2p,red"}, but I also feel that it makes the argument more complicated than strings. So I don't implement the dict-style argument.

Related to #4240

@seisman seisman added this to the 0.18.0 milestone Dec 4, 2025
@seisman seisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. labels Dec 4, 2025
Comment thread pygmt/src/coast.py Outdated
Comment on lines +131 to +138
**Examples:**

- ``rivers=1``: Draw permanent major rivers with default pen.
- ``rivers="1/0.5p,blue"``: Draw permanent major rivers with a 0.5-point blue
pen.
- ``rivers=["1/0.5p,blue", "5/0.3p,cyan,dashed"]``: Draw permanent major rivers
with a 0.5-point blue pen and intermittent major rivers with a 0.3-point
dashed cyan pen.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a few examples to explain it better.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@seisman seisman added the skip-changelog Skip adding Pull Request to changelog label Dec 7, 2025
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Boring but important stuff for the core devs skip-changelog Skip adding Pull Request to changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants