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
Expected outcome I would expect the axis to use the passed Formatter like the linear scaled axis does:
Matplotlib version
Matplotlib was installed from the conda-forge channel.
Thanks for your great work!
/Lukas
It is using your formatter for the major ticks (the 1000.000 at the top), but log scale now also turns on minor ticks by default (see http://matplotlib.org/users/dflt_style_changes.html#logformatter-labeling-of-minor-ticks ).
You will need to either turn off the minor formatters or also set them to what you want.
Closing this as not a bug, where would you have looked for documentation on this?
Thank you for the quick response! Setting the minor formatter as well leads to the wanted result.
I just did not realise that the ticks in the log-scaled version are minor. Being aware of this, the solution (setting minor_formatter) seems natural.
Activity
tacaswell commented on Apr 20, 2017
It is using your formatter for the major ticks (the 1000.000 at the top), but log scale now also turns on minor ticks by default (see http://matplotlib.org/users/dflt_style_changes.html#logformatter-labeling-of-minor-ticks ).
You will need to either turn off the minor formatters or also set them to what you want.
tacaswell commented on Apr 20, 2017
Closing this as not a bug, where would you have looked for documentation on this?
lkluft commented on Apr 20, 2017
Thank you for the quick response! Setting the minor formatter as well leads to the wanted result.
I just did not realise that the ticks in the log-scaled version are minor. Being aware of this, the solution (setting minor_formatter) seems natural.