# Plot swath profile using pygmt

**URL:** <https://forum.generic-mapping-tools.org/t/plot-swath-profile-using-pygmt/3518>\
**Category:** PyGMT Q&A\
**Created:** [December 6, 2022, 3:19pm UTC](https://forum.generic-mapping-tools.org/t/plot-swath-profile-using-pygmt/3518 "2022-12-06T15:19:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohseniaref](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/mohseniaref/32/2608_2.png) [@mohseniaref](https://forum.generic-mapping-tools.org/u/mohseniaref)\
**Post date:** [December 6, 2022, 3:19pm UTC](https://forum.generic-mapping-tools.org/t/plot-swath-profile-using-pygmt/3518/1 "2022-12-06T15:19:05Z")

</div>

Dear all,

It seems grdtrack is implemented in pygmt but I can not keys similar [https://docs.generic-mapping-tools.org/latest/grdtrack.html](https://docs.generic-mapping-tools.org/latest/grdtrack.html)

Is it possible to plot this example in pygmt

> **[(33) Stacking automatically generated cross-profiles — GMT 6.1.1 documentation](https://docs.generic-mapping-tools.org/6.1/gallery/ex33.html)**

Best regards,  
Mohammad

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/weiji14/32/33_2.png) [@weiji14](https://forum.generic-mapping-tools.org/u/weiji14)\
**Post date:** [December 8, 2022, 5:55pm UTC](https://forum.generic-mapping-tools.org/t/plot-swath-profile-using-pygmt/3518/2 "2022-12-08T17:55:02Z")

</div>

Yes it should be possible. The `-G` in `grdtrack` has been aliased to `grid` in PyGMT, though it’s not appearing in the docs. For example, the GMT command like:

```bash
gmt grdtrack ridge.txt -Gspac_33.nc -C400k/2k/10k+v -Sm+sstack.txt > table.txt

```

would look like this in PyGMT:

```python
pygmt.grdtrack(points="ridge.txt", grid="spac_33.nc", crossprofile="400k/2k/10k+v", stack="m+sstack.txt", outfile="table.txt")

```

See also code at [https://github.com/GenericMappingTools/pygmt/blob/v0.7.0/pygmt/src/grdtrack.py#L329](https://github.com/GenericMappingTools/pygmt/blob/v0.7.0/pygmt/src/grdtrack.py#L329) where this is being handled.
