Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
WIP: Add offset normalizer #3858
Trying to close #1806
Not currently on a good machine for development, but I think this pretty straight-forward, so hopefully Travis a test runner will suffice...
offset = mcolors.OffsetNorm(vmin=-1, vcenter=0, vmax=2) offset([-1.0, -0.5, 0.0, 1.0, 2.,]) #prints [0, 0.25, 0.5, 0.75, 1.0]
Next I'll add
sym = mcolors.SymNorm(vmin=-1, vcenter=0, vmax=2) sym([-1.0, -0.5, 0.0, 1.0, 2.,]) #prints [0.25, 0.325, 0.5, 0.75, 1.0]
You are right about my last comment, but i have still three points:
os = OffsetNorm(-5, -2, -1) x = np.linspace(-6, 6, 100) abs(x-os.inverse(os(x))).max() #should be zero, but is two
This is why my stackoverflow answer (which you probably read before :)) divides by
instead of vmax-vcenter.
Second point the class has no docstring.
Here's that SO solution from @Tillsten