GenericMappingTools / pygmt

A Python interface for the Generic Mapping Tools.
https://www.pygmt.org
BSD 3-Clause "New" or "Revised" License
758 stars 220 forks source link

Provide access to GMT native colormaps #381

Open MarkWieczorek opened 4 years ago

MarkWieczorek commented 4 years ago

As far as I can tell, it is currently not possible to make use of the native GMT colormaps outside of the pygmt routines. There are lot of reasons of why you might want to use these elsewhere. For example, you might want to plot colored x-y data in a matplotlib image and use the same colormap in an accompanying pygmt map.

Some of these colormaps (such as Fabio Crameri's) can be downloaded and installed separately. Nevertheless, it would be much more convenient if these colormaps were all included explicitly in pygmt (such as in a module cmap, for example).

leouieda commented 4 years ago

Hi @MarkWieczorek this is a bit tricky right now since we don't really have access to the GMT colormaps in memory. It's not impossible but right now they are handled by GMT as a hidden file. I agree that it would be good to be able to use GMT and maptlotlib colormaps interchangeably. I'm focusing more on the foundations of the library than adding new features still but let's keep this as a requested feature.

MarkWieczorek commented 4 years ago

Perhaps a bigger issue is that it is not possible to pipe a custom matplotlib colormap into pygmt. An easy way to do this would be to provide a function pygmt.cmap_to_cpt(), which could then be used by pygmt.makecpt()

seisman commented 2 years ago

Related codes: