Skip to content

Figure.colorbar: Add alias 'dpi' for the -N option#4501

Merged
seisman merged 7 commits intomainfrom
colorbar/dpi
Apr 9, 2026
Merged

Figure.colorbar: Add alias 'dpi' for the -N option#4501
seisman merged 7 commits intomainfrom
colorbar/dpi

Conversation

@seisman
Copy link
Copy Markdown
Member

@seisman seisman commented Apr 7, 2026

This PR adds an alias for the -N option (xref: https://docs.generic-mapping-tools.org/6.6/colorbar.html#n)

-N[p|dpi]
Controls how the color scale should be encoded graphically. To preferentially draw color rectangles (e.g., for discrete colors), append p. Otherwise we will preferentially draw images (e.g., for continuous colors). Optionally append effective dots-per-inch for rasterization of color scales [600].

This option has four possible use cases:

  • No -N: GMT defaults to drawing the color scale as images or rectangles depending on different conditions (e.g., a continuous or discrete scale).
  • -Np: draw color rectangles
  • -N300: draw as image with a dpi of 300
  • -N: equivalent to -N600

This PR provides the dpi parameter:

  • dpi=300 -> -N300
  • dpi=0 -> -Np (a zero dpi makes no sense so it's mapped to -Np)

Notes:

  • dpi=True is not supported to make the parameter simple.

@seisman seisman added this to the 0.19.0 milestone Apr 7, 2026
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Apr 7, 2026
@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 Apr 9, 2026
Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com>
@seisman seisman merged commit f433f9e into main Apr 9, 2026
15 of 18 checks passed
@seisman seisman deleted the colorbar/dpi branch April 9, 2026 09:58
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants