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 Figure.vlines for plotting vertical lines #3726

Merged
merged 6 commits into from
Dec 28, 2024
Merged

Add Figure.vlines for plotting vertical lines #3726

merged 6 commits into from
Dec 28, 2024

Conversation

seisman
Copy link
Member

@seisman seisman commented Dec 26, 2024

Description of proposed changes

Similar to #923 but for plotting vertical lines.

Example

import pygmt

fig = pygmt.Figure()

# Cartesian projection
fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=True)
fig.vlines(x=1, pen="1p,black", label="Line 1")
fig.vlines(x=2, ymin=2, ymax=8, pen="1p,red,-", label="Line 2")
fig.vlines(x=[3, 4], ymin=3, ymax=7, pen="1p,black,.", label="Line 3")
fig.vlines(x=[5, 6], ymin=4, ymax=9, pen="1p,red", label="Line 4")
fig.vlines(x=[7, 8], ymin=[0, 1], ymax=[7, 8], pen="1p,blue", label="Line 5")
fig.legend()

fig.shift_origin(xshift="w+2c")
# Geographic 
fig.basemap(region="g", projection="R15c", frame=True)
fig.vlines(x=50, ymin=-50, ymax=50, pen="1p")

fig.shift_origin(xshift="w+2c")
# Polar
fig.basemap(region=[0, 360, 0, 1], projection="P10c", frame=True)
fig.vlines(x=120, ymin=0.2, ymax=0.8, pen="1p")
fig.show()

vlines

Preview: https://pygmt-dev--3726.org.readthedocs.build/en/3726/api/generated/pygmt.Figure.vlines.html

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.

Slash Commands

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

  • /format: automatically format and lint the code

Copy link
Contributor

github-actions bot commented Dec 26, 2024

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
added pygmt/tests/baseline/test_vlines_clip.png
added pygmt/tests/baseline/test_vlines_geographic_global.png
added pygmt/tests/baseline/test_vlines_multiple_lines.png
added pygmt/tests/baseline/test_vlines_one_line.png
added pygmt/tests/baseline/test_vlines_polar_projection.png

Image diff(s)

Added images

  • test_vlines_clip.png

  • test_vlines_geographic_global.png

  • test_vlines_multiple_lines.png

  • test_vlines_one_line.png

  • test_vlines_polar_projection.png

Modified images

Path Old New

Report last updated at commit 3548dfa

@seisman seisman added feature Brand new feature final review call This PR requires final review and approval from a second reviewer labels Dec 26, 2024
@seisman seisman added this to the 0.14.0 milestone Dec 26, 2024
@seisman seisman mentioned this pull request Dec 26, 2024
49 tasks
pygmt/src/vlines.py Outdated Show resolved Hide resolved
pygmt/src/vlines.py Outdated Show resolved Hide resolved
pygmt/tests/test_vlines.py Outdated Show resolved Hide resolved
pygmt/tests/test_vlines.py Outdated Show resolved Hide resolved
pygmt/src/vlines.py Outdated Show resolved Hide resolved
seisman and others added 4 commits December 27, 2024 23:43
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Dec 28, 2024
@seisman seisman merged commit 2c0f75f into main Dec 28, 2024
22 checks passed
@seisman seisman deleted the feature/vlines branch December 28, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Brand new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants