Skip to content

LogNorm colorbar prints double tick labels after set_ticks() #13112

@poppie137

Description

@poppie137

Bug report

Bug summary

Some colorbar labels are printed twice when I use a colorbar with LogNorm and small ranges of numbers after setting the ticks manually with set_ticks().

See figure below: By setting the minor_thresholds to something low, the double ticklabel at 20000 disappears, so it could have something to do with the minor formatter in LogFormatterSciNotation?

I think it could be related to other issues that have been posted: #12488 #12503

Code for reproduction

import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
import matplotlib.ticker as ticker

fig, ax = plt.subplots()
pcm = ax.imshow([[10000, 25000]], norm=mcolors.LogNorm())
cb = fig.colorbar(pcm)
# cb.formatter.minor_thresholds = [0,0] # deactivates minor ticks labels?
cb.formatter = ticker.EngFormatter()
cb.set_ticks([10000,20000,25000])

Actual outcome

image

Expected outcome

There should be no double ticks.

Matplotlib version

  • Operating system: OSX
  • Matplotlib version: 3.0.2
  • Matplotlib backend: Qt5Agg
  • Python version: 3.7
  • Jupyter version (if applicable): -
  • Other libraries: -
    I installed matplotlib via conda through the default channel.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions