How to add the colorpalette

http://soliton.vm.bytemark.co.uk/pub/cpt-city/views/totp-cpt.htm

How do I use the color palette I downloaded here on pygmt?

Thank you.

1 Like

I’m not familiar with pyGMT but have you tried the docs?

Hello @prince-Ha,
As mentioned by @KristofKoch you can use a colorpalette downloaded from cpt-city (you need the .cpt format) via pygmt.makecpt, similarly as the GMT build-in colormaps. Please place the downloaded cpt file in your working dictionary or pass the whole path along with the file name to the cmap parameter. For further adjustments to make the final colormap meet your personal needs, you may want to have a look at the documentation at https://www.pygmt.org/latest/api/generated/pygmt.makecpt.html.

General code example:

import pygmt

pygmt.makecpt(
    # replace the argument by the file name of your colorpalette file name
    cmap="my_downloaded_colormap.cpt",  
)

I solved the problem using below method

thank you : )

  • download and make a colorpalette

  • load the palette in cmap

  • example code :

import pygmt
fig = pygmt.Figure()
pygmt.makecpt(cmap=“temperature.cpt+h”, series=[x.values.min(), x.values.max()])