Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gallery example "Scale bar" #2822

Merged
merged 52 commits into from
Dec 25, 2023
Merged

Add gallery example "Scale bar" #2822

merged 52 commits into from
Dec 25, 2023

Conversation

yvonnefroehlich
Copy link
Member

@yvonnefroehlich yvonnefroehlich commented Nov 19, 2023

Description of proposed changes

This PR aims to add a gallery example showing how to configurate a scale bar:

Upstream GMT documentation:

Preview: https://pygmt-dev--2822.org.readthedocs.build/en/2822/gallery/embellishments/scalebar.html

Fixes #2627

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Nov 19, 2023
@yvonnefroehlich yvonnefroehlich added this to the 0.11.0 milestone Nov 19, 2023
@yvonnefroehlich yvonnefroehlich self-assigned this Nov 19, 2023
@yvonnefroehlich
Copy link
Member Author

/format

@yvonnefroehlich

This comment was marked as off-topic.

@seisman

This comment was marked as off-topic.

@seisman

This comment was marked as off-topic.

examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
@yvonnefroehlich

This comment was marked as off-topic.

@seisman

This comment was marked as off-topic.

examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
# -----------------------------------------------------------------------------
# Add a thick scale bar
# Adjust the GMT default parameter MAP_SCALE_HEIGHT locally (the change applies
# only to the code within the "with" block)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# only to the code within the "with" block)
# only to the code within the "with" statement)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm. I am still not 100 % sure whether within the "with" statement sounds better than within the "with" block and makes sense. Maybe we can write under the "with" statement if we want to use statement instead of block?

Copy link
Member

Choose a reason for hiding this comment

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

I feel 'within the "with" statement' is better.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK. Should I also update the formulations in the Figure.inset line example:

pygmt/pygmt/src/inset.py

Lines 119 to 131 in 06ae818

>>> # Use a "with" statement to initialize the inset context manager
>>> # Setting the position to top left and a width of 3.5 centimeters
>>> with fig.inset(position="jTL+w3.5c+o0.2c", margin=0, box="+pgreen"):
... # Map elements under the "with" statement are plotted in the inset
... fig.coast(
... region="g",
... projection="G47/-20/3.5c",
... land="gray",
... water="white",
... dcw="MG+gred",
... )
...
>>> # Map elements outside the "with" block are plotted in the main figure

@yvonnefroehlich yvonnefroehlich added the needs review This PR has higher priority and needs review. label Dec 19, 2023
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
yvonnefroehlich and others added 4 commits December 20, 2023 10:43
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Michael Grund <[email protected]>
examples/gallery/embellishments/scalebar.py Outdated Show resolved Hide resolved
@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 24, 2023
@seisman seisman merged commit ff1af6b into main Dec 25, 2023
9 checks passed
@seisman seisman deleted the add-gallery-scalebar branch December 25, 2023 10:27
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Dec 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gallery example for configuring scale bar
4 participants