Skip to content

Conversation

seisman
Copy link
Member

@seisman seisman commented Aug 10, 2025

This PR implements the Figure.magnetic_rose method to plot a magnetic rose. It wraps the basemap/coast's -Tm option.

Preview:

The GMT CLI syntax is

-Tm[g|j|J|n|x]refpoint[+ddec[/dlabel]]][+ipen][+jjustify][+l[w,e,s,n]][+ppen][+tints][+odx[/dy]][+wwidth]

The Pythonic long-form parameters are:

  • g|j|J|n|x: position_type
  • refpoint: position
  • +j: anchor
  • +o: anchor_offset
  • +w: width
  • +p: outer_pen
  • +i: inner_pen
  • +l: labels
  • +d: declination, declination_label
  • +t: intervals

Examples

import pygmt
fig = pygmt.Figure()
fig.basemap(region=[-10, 10, -10, 10], projection="M15c", frame=True)
fig.magnetic_rose(
    position=(-5, -5),
    position_type="mapcoords",
    width="4c",
    labels=["W", "E", "S", "*"],
    intervals=(45, 15, 3, 60, 20, 4),
    outer_pen="1p,red",
    inner_pen="1p,blue",
    declination=11.5,
    declination_label="11.5°E",
)
fig.show()

Addressing #2831.

@seisman seisman added the feature Brand new feature label Sep 6, 2025
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.

1 participant