How to use the colorcet.diverging_linear_bjy_30_90_c45 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 cortex-lab / phy / phy / utils / color.py View on Github external
[0.4, 0.4, 0.4],  # noise
        [0.5, 0.5, 0.5],  # mua
        [0.5254, 0.8196, 0.42745],  # good
        [0.75, 0.75, 0.75],  # '' (None = '' = unsorted)
    ])


"""Built-in colormaps."""
colormaps = Bunch(
    blank=np.array([[.75, .75, .75]]),
    default=_make_default_colormap(),
    cluster_group=_make_cluster_group_colormap(),
    categorical=np.array(cc.glasbey_bw_minc_20_minl_30),
    rainbow=np.array(cc.rainbow_bgyr_35_85_c73),
    linear=np.array(cc.linear_wyor_100_45_c55),
    diverging=np.array(cc.diverging_linear_bjy_30_90_c45),
)


def selected_cluster_color(i, alpha=1.):
    """Return the color, as a 4-tuple, of the i-th selected cluster."""
    return add_alpha(tuple(colormaps.default[i % len(colormaps.default)]), alpha=alpha)


def spike_colors(spike_clusters, cluster_ids):
    """Return the colors of spikes according to the index of their cluster within `cluster_ids`.

    Parameters
    ----------

    spike_clusters : array-like
        The spike-cluster assignments.