[yt-users] Can these colormaps be imported?

Kacper Kowalik xarthisius.kk at gmail.com
Wed Jul 26 07:57:31 PDT 2017


On 07/26/2017 09:35 AM, Joseph Smidt wrote:
> Hey everyone,
> 
>     This repo has some perceptually uniform colormaps that are not in
> standard matplotlib/yt. [1] More info here[2] 
> 
> Anyway, it is not clear to me from his documentation how I might import
> these colormaps in a way I could use with YT.  Does anyone have an idea
> how that can be done? They seem to be a set of .csv files.   Thanks. 
> 
> [1] https://github.com/bokeh/colorcet
> 
> [2] http://peterkovesi.com/projects/colourmaps/

Hi,
yt uses matplotlib (in most cases) for plotting. Just install colorcet
as shown in [1]. Then:

import yt
import colorcet as cc

ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
slc = yt.SlicePlot(ds, 'z', 'density')
slc.set_cmap('density', cc.m_fire)
# alternatively
slc.set_cmap('density', cc.cm['fire'])
slc.save()

As described in the notebook also in [1].

New colormaps can be also added via:

yt.visualization.color_maps.add_cmap('cc_fire', cc.fire)

Cheers,
Kacper


>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170726/71f055af/attachment-0001.pgp>


More information about the yt-users mailing list