-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Description
Bug report
contourf produces wrongly formatted plot labels for logarithmic plots when there is only one order of magnitude or less of range of data (eg. 10 to 100 or 100 to 1000).
Code for reproduction
import matplotlib.pyplot as plt
from matplotlib.ticker import StrMethodFormatter
import numpy as np
t = np.linspace(0,1000,1001)
p = np.array([10,20,30,40,50,60,70,80,90,100])
data = np.random.random_sample((len(p),len(t)))
pressure,time = np.meshgrid(p,t)
fig, ax = plt.subplots(nrows=2)
ax1, ax2 = tuple(ax)
ax1.contourf(time,pressure,data.T)
ax1.set_yscale('log')
ax1.set_yticks([10,30,100])
ax1.get_yaxis().set_major_formatter(StrMethodFormatter('{x:.0f}'))
ax2.plot(p)
ax2.set_yscale('log')
ax2.set_yticks([10,30,100])
ax2.get_yaxis().set_major_formatter(StrMethodFormatter('{x:.0f}'))
plt.show()Actual outcome
Using matplotlib 2.0.0 the labelling of the y-axis of the contour plot is messed up compared to the y-axis of the line plot.

Remark: The default color map was used.
Expected outcome
Using matplotlib 1.5.1 the labelling of the y-axis of the contour plot is as beautiful as the labelling of the y-axis of the line plot.

Remark: The default color map was used.
Matplotlib version
matplotlib 2.0.0 (installed using pip)
python 3.6.1 (installed using brew)
macos
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels