Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Blank colorbars for high dynamic range LogNorm imshow plots #10051

Copy link
Copy link
Closed
@ngoldbaum

Description

@ngoldbaum
Issue body actions

Bug summary

When creating a LogNorm imshow plot with more than 9 orders of magnitude of dynamic range the automatically generated colorbar from plt.colorbar() has no automatically generated tick marks or labels.

Code for reproduction

This generates a plot with colorbar tick labels

import numpy as np

from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm

data = np.zeros((800, 800)) + 1
data[50, 51] = 1e9

print(np.log10(data.max()/data.min()))

image = plt.imshow(data, origin='lower', interpolation='nearest', norm=LogNorm())
plt.colorbar(image)

plt.savefig('labels.png')

labels

While this script generates a plot with no colorbar tick labels:

import numpy as np

from matplotlib import pyplot as plt
from matplotlib.colors import LogNorm

data = np.zeros((800, 800)) + 1
data[50, 51] = 2e9

print(np.log10(data.max()/data.min()))

image = plt.imshow(data, origin='lower', interpolation='nearest', norm=LogNorm())
plt.colorbar(image)

plt.savefig('no-labels.png')

no-labels

Expected outcome

I would expect the second plot to also have colorbar tick labels.

Matplotlib version

  • Operating system: Mac OS High Sierra
  • Matplotlib version: 2.1.1 (installed via pip)
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.6
ax3l

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.