Skip to content

Figure.barb: Plot wind barbs in 2-D and 3-D #4232

Open

Description

@yvonnefroehlich

This issue serves as the central place for discussing and tracking the implementation of the Figure.barb() method in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.

Example

input data: barbs_strength.txt, barbs_direction.txt

import pygmt

pen_barb = "0.5p,darkorange"
fill_barb = "brown"

fig = pygmt.Figure()
fig.basemap(region=[-5, 5] * 2, projection="X10c", frame=0)

for barbs_data, use_word in zip(
    ["barbs_strength.txt", "barbs_direction.txt"], [1, 0]
):
    with pygmt.clib.Session() as session:
        session.call_module(
            'barb',
            '{} \
            -W{} \
            -G{} \
            -Q{}' \
            .format(barbs_data, pen_barb, fill_barb, '0.5c')
        )
    fig.text(barbs_data, offset="0c/-0.05c", justify="TC", font="5p", use_word=use_word)
fig.show()
Image

Documentation

GMT Option Flags and Modifieres

☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.

  • -R: region #XXX
  • -J: projection #XXX
  • -B: frame
  • -G: fill
  • -W: pen
  • -Q:
  • -C: cmap
  • -D:
  • -I:
  • -N: no_clip
  • -U: Use Figure.timestamp instead.
  • -X/-Y: Use Figure.shift_origin instead.
  • --PAR=value: Use pygmt.config instead.

Notes on Input Formats

Add any notes on the input formats, especially the meaning of columns.

Linked Pull Requests

  • Initial feature implementation #XXX
  • Add a tutorial or gallery example

Related Issues and Discussions

Add links to related wrapper discussions, API design threads, or upstream GMT changes here.

Activity

  1. added
    help wanted
    on Jul 25, 2026
  2. jjohnnystwsss commented on Nov 21, 2026

    @jjohnnystwsss

    I would like to work on the initial Figure.barb wrapper, if it is still available.

    For a small first PR, I propose table input (files, NumPy arrays and pandas DataFrames), 2-D and 3-D plotting through the usual projection/zscale/zsize options, and the essential region/frame/fill/pen options. For GMT -Q, I suggest a style string initially, preserving GMT modifiers including +z for u/v components, rather than introducing a separate parameter class. I would use the current AliasSystem and add focused input tests plus 2-D/3-D image comparisons. A gallery example would follow separately, as the contribution guide requests.

    Does this initial scope work for you, and is style a suitable name for -Q? I will wait for your feedback before implementing. I plan to use Codex assistance and disclose it in the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requesthelp wanted

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions