Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Normalize color by center
from matplotlib.colors import Normalize
class CenterNorm(Normalize):
'''Demos see'''
def __init__(self, vc=0, cc=0.5, vmin=None, vmax=None, clip=False):
vc value of center
cc color of center
Normalize.__init__(self, vmin, vmax, clip)
assert 0< cc < 1, "Central color should be in (0, 1)" = vc = cc
def __call__(self, value, clip=None):
dv = np.array([ - self.vmin, self.vmax -])
dc = np.array([, 1 -])
k = 1/max(dv/dc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment