[yt-users] Can these colormaps be imported?

Nathan Goldbaum nathan12343 at gmail.com
Wed Jul 26 08:09:25 PDT 2017


It's likely possible to make it so yt automatically imports the colormaps
from these packages if they're installed. We currently do that for
colormaps from cmocean and palettable if they are installed in the same
python environment as yt. You can see how that works for cmocean right here:

https://github.com/yt-project/yt/blob/master/yt/visualization/color_maps.py#L160

I'd +1 a pull request that did something similar for the packages you
suggested.

On Wed, Jul 26, 2017 at 9:57 AM, Kacper Kowalik <xarthisius.kk at gmail.com>
wrote:

> 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
> >
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20170726/1ed4e116/attachment-0001.html>


More information about the yt-users mailing list