How to translate GMT syntaxes into PYGMT?

Hi every one !

When I try to implement some little used elements and I go to the API Reference of the PYGMT site: It often refers us to the API Reference of GMT.

Problem, as we know, GMT syntaxes do not work on PyGMT but no translation guide exists to my knowledge.

For example:

I’m trying to change the origin of my CPT “Mag”. This color palette is centered on 0, I would like to center it on 4.

pygmt.makecpt(cmap=“mag”,A = 40, series=[-12, 16,0.5])

I find the command “+n” on the parameter “series” on the page pygmt.makecpt. We are referred to a GMT page to give us examples of implementation.
I tried several combinations like :

pygmt.makecpt(cmap=“mag”,A = 40, series=[-12, 16,0.5[+n]])

But it doesn’t work! If you know of a technique to translate GMT syntaxes into PyGMT I am very interested.

Hi Remy,

In order to use modifiers (e.g., “+n”), you would need to provide a str input rather than list. Regardless, to set the colormap hinge you would need to use +h on cmap.

pygmt.makecpt(cmap="mag+h4", transparency=40, series=[-12, 16])

Note that your original command included a resampling of discrete colormap, which would be ignored because GMT imposes a limitation that only continuous colormaps can be resampled to avoid aliasing.