Can these colormaps be imported?
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/
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.
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
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#... 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@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.
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@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
participants (3)
-
Joseph Smidt
-
Kacper Kowalik
-
Nathan Goldbaum