Skip to content

Issue with minor tick spacing in colorbar with custom Normalize class #12808

@astrofrog

Description

@astrofrog

Bug report

Bug summary

Minor ticks don't appear in the right place in colorbars when a custom Normalize class is used.

Code for reproduction

The following example requires astropy. If needed I can try and provide an example that doesn't use this.

import numpy as np
import matplotlib.pyplot as plt
from astropy.visualization import LogStretch, ImageNormalize, PercentileInterval

data = np.arange(256).reshape((16, 16))

norm = ImageNormalize(data, interval=PercentileInterval(99), stretch=LogStretch())

plt.rcParams['xtick.minor.visible'] = True

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
im = ax.imshow(data, norm=norm)
cb = fig.colorbar(im)
fig.savefig('test.png')

Actual outcome

test

Expected outcome

The minor ticks should respect the spacing of the current stretch.

I noticed that using LogNorm, the ticks used to be spaced incorrectly in Matplotlib 2.2 but this was fixed in Matplotlib 3.0. However, the minor ticks are still broken for custom normalizations as shown above.

Matplotlib version

  • Operating system: MacOS X 10.13.6
  • Matplotlib version: 3.0.1
  • Matplotlib backend: Agg
  • Python version: 3.7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy