Fix twoslopenorm colorbar by jklymak · Pull Request #20582 · matplotlib/matplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/matplotlib/colors.py
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions lib/matplotlib/tests/test_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,12 @@ def test_inset_colorbar_layout():
@image_comparison(['colorbar_twoslope.png'], remove_text=True,
style='mpl20')
def test_twoslope_colorbar():
# Note that the first tick = 20, and should be in the middle
# Note that the second tick = 20, and should be in the middle
# of the colorbar (white)
# There should be no tick right at the bottom, nor at the top.
fig, ax = plt.subplots()

norm = mcolors.TwoSlopeNorm(20, 0, 100)
norm = mcolors.TwoSlopeNorm(20, 5, 95)
pc = ax.pcolormesh(np.arange(1, 11), np.arange(1, 11),
np.arange(100).reshape(10, 10),
norm=norm, cmap='RdBu_r')
Expand Down
20 changes: 15 additions & 5 deletions tutorials/colors/colormapnorms.py