From e962c0a84a28829fa95c24bc68e57395bda3d268 Mon Sep 17 00:00:00 2001 From: matthias-k Date: Mon, 11 Nov 2024 22:07:00 +0100 Subject: [PATCH] Option to specify colormap in visualize_distribution (#91) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Kümmmerer --- pysaliency/plotting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pysaliency/plotting.py b/pysaliency/plotting.py index d4e3dc5..0e129a5 100644 --- a/pysaliency/plotting.py +++ b/pysaliency/plotting.py @@ -150,11 +150,11 @@ def normalize_log_density(log_density): unsorted_cummulative = cummulative[np.argsort(inds)] return unsorted_cummulative.reshape(log_density.shape) -def visualize_distribution(log_densities, ax=None, levels=None, level_colors='black'): +def visualize_distribution(log_densities, ax=None, levels=None, level_colors='black', cmap=plt.cm.viridis): if ax is None: ax = plt.gca() t = normalize_log_density(log_densities) - img = ax.imshow(t, cmap=plt.cm.viridis) + img = ax.imshow(t, cmap=cmap) if levels is None: levels = [0, 0.25, 0.5, 0.75, 1.0] cs = ax.contour(t, levels=levels, colors=level_colors)