From 368bbd6d8bbab34e6500fce9a8f20cbcbda02c62 Mon Sep 17 00:00:00 2001 From: Niru Maheswaranathan Date: Tue, 22 Mar 2016 23:49:02 -0700 Subject: [PATCH] changing default colormaps --- jetpack/chart.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/jetpack/chart.py b/jetpack/chart.py index 4b3d8a9..867480f 100644 --- a/jetpack/chart.py +++ b/jetpack/chart.py @@ -9,10 +9,10 @@ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation -from functools import wraps +from functools import wraps, partial __all__ = ['plotwrapper', 'image', 'hist', 'hist2d', 'errorplot', 'random_slice', - 'setfontsize', 'noticks', 'nospines', 'breathe', 'play'] + 'setfontsize', 'noticks', 'nospines', 'breathe', 'play', 'imv'] def plotwrapper(fun): @@ -89,7 +89,7 @@ def image(data, mode='div', center=True, cmap=None, aspect='equal', vmin=None, v Whether or not to mean-subtract the image cmap : string, optional - A matplotlib colormap to use (default: 'seismic' for 'div', 'gray' for 'seq') + A matplotlib colormap to use (default: 'seismic' for 'div', 'viridis' for 'seq') aspect : string, optional Same as in plt.imshow, either 'equal' or 'auto' @@ -124,7 +124,7 @@ def image(data, mode='div', center=True, cmap=None, aspect='equal', vmin=None, v if vmax is None: vmax = img_max if cmap is None: - cmap = 'gray' + cmap = 'viridis' else: raise ValueError("Unrecognized mode: '" + mode + "'") @@ -184,7 +184,7 @@ def corrplot(C, cmap=None, cmap_range=(0.0, 1.0), cbar=True, fontsize=14, **kwar elif max(cmap_range) <= 0: cmap = "RdBu" else: - cmap = "gray" + cmap = "viridis" # remove values rr, cc = np.triu_indices(n, k=1) @@ -398,3 +398,6 @@ def breathe(factor=0.05, **kwargs): ax.spines['left'].set_bounds(ya, yb) nospines(**kwargs) + +# helper functions +imv = partial(image, mode='seq')