Skip to content

Log-scale ignores Formatter #8517

@lkluft

Description

@lkluft

Bug report

Bug summary
Logarithmic scaling seems to break the label formatting.

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib import ticker
import numpy as np


p = np.linspace(1000, 500, 100)
T = np.linspace(300, 200, p.size)


fig, ax = plt.subplots()
ax.plot(T, p)
ax.set_yscale('log')
ax.yaxis.set_major_formatter(ticker.StrMethodFormatter('{x:.3f}'))

plt.show()

The issue is reproducible using different Formatters (e.g. FuncFormatter, ...).

Actual outcome
outcome

Expected outcome
I would expect the axis to use the passed Formatter like the linear scaled axis does:

expected

Matplotlib version

  • Operating System: macOS Sierra (10.12.4) | Debian GNU/Linux 8.6
  • Matplotlib Version: 2.0.0
  • Python Version: 3.6.1

Matplotlib was installed from the conda-forge channel.

Thanks for your great work!

/Lukas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions