How to use the colorcet.fire function in colorcet

To help you get started, we’ve selected a few colorcet examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lmcinnes / umap / umap / plot.py View on Github external
import bokeh.plotting as bpl
import bokeh.transform as btr
import holoviews as hv
import holoviews.operation.datashader as hd

import sklearn.decomposition
import sklearn.cluster
import sklearn.neighbors

from umap.nndescent import initialise_search, initialized_nnd_search
from umap.utils import deheap_sort, submatrix

from bokeh.plotting import output_notebook, output_file, show
from warnings import warn

fire_cmap = matplotlib.colors.LinearSegmentedColormap.from_list('fire', colorcet.fire)
darkblue_cmap = matplotlib.colors.LinearSegmentedColormap.from_list('darkblue', colorcet.kbc)
darkgreen_cmap = matplotlib.colors.LinearSegmentedColormap.from_list('darkgreen', colorcet.kgy)
darkred_cmap = matplotlib.colors.LinearSegmentedColormap.from_list('darkred',
                                                                   colors=colorcet.linear_kry_5_95_c72[:192],
                                                                   N=256)
darkpurple_cmap = matplotlib.colors.LinearSegmentedColormap.from_list('darkpurple',
                                                                      colorcet.linear_bmw_5_95_c89)

plt.register_cmap('fire', fire_cmap)
plt.register_cmap('darkblue', darkblue_cmap)
plt.register_cmap('darkgreen', darkgreen_cmap)
plt.register_cmap('darkred', darkred_cmap)
plt.register_cmap('darkpurple', darkpurple_cmap)


def _to_hex(arr):
github holoviz / holoviz / examples / tutorial / apps / taxi_player / main.py View on Github external
import dask.dataframe as dd
import holoviews as hv
import parambokeh
import param

from colorcet import cm_n, fire

from bokeh.models import Slider, Button
from bokeh.layouts import layout
from bokeh.io import curdoc

from holoviews.operation.datashader import aggregate, shade
from holoviews.element.tiles import EsriImagery


shade.cmap = fire

hv.extension('bokeh')
renderer = hv.renderer('bokeh').instance(mode='server')

# Load data
ddf = dd.read_parquet(os.path.join(os.path.dirname(__file__),'..','..','..','data','nyc_taxi_wide.parq', engine='fastparquet')).persist()
tiles = EsriImagery()

stream = hv.streams.Stream.define('HourSelect', hour=0)()
points = hv.Points(ddf, kdims=['dropoff_x', 'dropoff_y'])
dmap = hv.util.Dynamic(points, operation=lambda obj, hour: obj.select(dropoff_hour=hour).relabel('Hour of Day: %d' % hour),
                       streams=[stream])

# Apply aggregation
aggregated = aggregate(dmap, link_inputs=True, streams=[hv.streams.RangeXY], width=1200, height=600)