Skip to main content

A Python interface for the Generic Mapping Tools

Project description

PyGMT

A Python interface for the Generic Mapping Tools

Documentation (development version) | Contact | TryOnline

Latest version on PyPI Latest version on conda-forge GitHub license Compatible Python versions Digital Object Identifier for the Zenodo archive Discourse forum PyOpenSci Contributor Code of Conduct GitHub Actions Tests status GitHub Actions GMT Dev Tests status Test coverage status Ruff CodSpeed Performance Benchmarks

Why PyGMT?

A beautiful map is worth a thousand words. To truly understand how powerful PyGMT is, play with it online on Binder! For a quicker introduction, check out our 3 minute overview!

Afterwards, feel free to look at our Tutorials, visit the Gallery, and check out some external PyGMT examples!

Quick Introduction to PyGMT YouTube Video

About

PyGMT is a library for processing geospatial and geophysical data and making publication-quality maps and figures. It provides a Pythonic interface for the Generic Mapping Tools (GMT), a command-line program widely used across the Earth, Ocean, and Planetary sciences and beyond.

Project goals

  • Make GMT more accessible to new users.
  • Build a Pythonic API for GMT.
  • Interface with the GMT C API directly using ctypes (no system calls).
  • Support for rich display in the Jupyter notebook.
  • Integration with the scientific Python ecosystem: numpy.ndarray or pandas.DataFrame for data tables, xarray.DataArray for grids, and geopandas.GeoDataFrame for geographical data.

Quickstart

Installation

Simple installation using mamba:

mamba install --channel conda-forge pygmt

If you use conda:

conda install --channel conda-forge pygmt

For other ways to install pygmt, see the full installation instructions.

Getting started

As a starting point, you can open a Python interpreter or a Jupyter notebook, and try the following example:

import pygmt
fig = pygmt.Figure()
fig.coast(projection="N15c", region="g", frame=True, land="tan", water="lightblue")
fig.text(position="MC", text="PyGMT", font="80p,Helvetica-Bold,red@75")
fig.show()

You should see a global map with land and water masses colored in tan and lightblue, respectively. On top, there should be the semi-transparent text "PyGMT". For more examples, please have a look at the Gallery and Tutorials.

Contacting us

Contributing

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Contributing guidelines

Please read our Contributing Guide to see how you can help and give feedback.

Imposter syndrome disclaimer

We want your help. No, really.

There may be a little voice inside your head that is telling you that you're not ready to be an open source contributor; that your skills aren't nearly good enough to contribute. What could you possibly offer?

We assure you that the little voice in your head is wrong.

Being a contributor doesn't just mean writing code. Equally important contributions include: writing or proof-reading documentation, suggesting or implementing tests, or even giving feedback about the project (including giving feedback about the contribution process). If you're coming to the project with fresh eyes, you might see the errors and assumptions that seasoned contributors have glossed over. If you can write any code at all, you can contribute code to open source. We are constantly trying out new skills, making mistakes, and learning from those mistakes. That's how we all improve and we are happy to help others learn.

This disclaimer was adapted from the MetPy project.

Citing PyGMT

PyGMT is a community developed project. See the AUTHORS.md file on GitHub for a list of the people involved and a definition of the term "PyGMT Developers". Feel free to cite our work in your research using the following BibTeX:

@software{
  pygmt_2025_15628725,
  author       = {Tian, Dongdong and
                  Uieda, Leonardo and
                  Leong, Wei Ji and
                  Fröhlich, Yvonne and
                  Grund, Michael and
                  Schlitzer, William and
                  Jones, Max and
                  Toney, Liam and
                  Yao, Jiayuan and
                  Tong, Jing-Hui and
                  Magen, Yohai and
                  Materna, Kathryn and
                  Belem, Andre and
                  Newton, Tyler and
                  Anant, Abhishek and
                  Ziebarth, Malte and
                  Quinn, Jamie and
                  Wessel, Paul},
  title        = {{PyGMT: A Python interface for the Generic Mapping Tools}},
  month        = jun,
  year         = 2025,
  publisher    = {Zenodo},
  version      = {0.16.0},
  doi          = {10.5281/zenodo.15628725},
  url          = {https://doi.org/10.5281/zenodo.15628725}
}

To cite a specific version of PyGMT, go to our Zenodo page at https://doi.org/10.5281/zenodo.3781524 and use the "Export to BibTeX" function there. It is also strongly recommended to cite the GMT 6 paper (which PyGMT wraps around). Note that some modules like dimfilter, surface, and x2sys also have their dedicated citations. Further information for all these can be found at https://www.generic-mapping-tools.org/cite.

License

PyGMT is free software: you can redistribute it and/or modify it under the terms of the BSD 3-clause License. A copy of this license is provided in LICENSE.txt.

Support

The development of PyGMT has been supported by NSF grants OCE-1558403 and EAR-1948603.

Related projects

Other official wrappers for GMT:

  • GMT.jl: A Julia wrapper for GMT.
  • gmtmex: A Matlab/Octave wrapper for GMT.

Minimum supported versions

PyGMT has adopted SPEC 0 alongside the rest of the scientific Python ecosystem, and made a few extensions based on the needs of the project. Please see Minimum Supported Versions for the detailed policy and the minimum supported versions of GMT, Python and core package dependencies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pygmt-0.16.0.tar.gz (217.7 kB view details)

Uploaded Source

Built Distribution

pygmt-0.16.0-py3-none-any.whl (301.3 kB view details)

Uploaded Python 3

File details

Details for the file pygmt-0.16.0.tar.gz.

File metadata

  • Download URL: pygmt-0.16.0.tar.gz
  • Upload date:
  • Size: 217.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pygmt-0.16.0.tar.gz
Algorithm Hash digest
SHA256 5921db8cd71d0da5d60afee36eaba496c953797e38b53b32583ed4ae61fab640
MD5 19909037911835239a47086d04b015a2
BLAKE2b-256 bca205d13c4814aef83d6fe3c19d03215d44a260090e85bbb724c1b9902ca20d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygmt-0.16.0.tar.gz:

Publisher: publish-to-pypi.yml on GenericMappingTools/pygmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygmt-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: pygmt-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 301.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pygmt-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b7d88c8c89180dde33992d3d07aaacda245111feadfb19f61cea420e11a25f27
MD5 ce8edd784069a8e2925680812d929acc
BLAKE2b-256 a2f442f2bf9150380ba2aaa9afb90c7d454f212b5a73a9361dcf8282d429e139

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygmt-0.16.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on GenericMappingTools/pygmt

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page