-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
class MidPointLogNorm(mcolors.LogNorm):
def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False):
mcolors.LogNorm.__init__(self,vmin=vmin, vmax=vmax, clip=clip)
self.midpoint=midpoint
def __call__(self, value, clip=None):
result, is_scalar = self.process_value(value)
x, y = [np.log(self.vmin), np.log(self.midpoint), np.log(self.vmax)], [0, 0.5, 1]
return np.ma.array(np.interp(np.log(value), x, y), mask=result.mask, copy=False)
# norm = mcolors.SymLogNorm(linthresh=permeation_number(pressures[0]), vmin=permeation_number(pressures[0]), vmax=permeation_number(pressures[-1]))
norm = MidPointLogNorm(vmin=permeation_number(pressures[0]), midpoint=1, vmax=permeation_number(pressures[-1]))
cmap = plt.cm.RdYlGnIssue: for some reason making the colourbar with:
sm = plt.cm.ScalarMappable(cmap=cmap, norm=norm)
plt.colorbar(
sm,
label="Permeation number",
ax=plt.gca(),
)Doesn't generate the right colourbar.... (the center is not on 1)
Metadata
Metadata
Assignees
Labels
No labels