Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/matplotlib/tests/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,13 @@ def test_contour_line_start_on_corner_edge():
cbar = fig.colorbar(filled)
lines = ax.contour(x, y, z, corner_mask=True, colors='k')
cbar.add_lines(lines)


@pytest.mark.style("default")
def test_contour_autolabel_beyond_powerlimits():
ax = plt.figure().add_subplot()
cs = plt.contour(np.geomspace(1e-6, 1e-4, 100).reshape(10, 10),
levels=[.25e-5, 1e-5, 4e-5])
ax.clabel(cs)
# Currently, the exponent is missing, but that may be fixed in the future.
assert {text.get_text() for text in ax.texts} == {"0.25", "1.00", "4.00"}
5 changes: 1 addition & 4 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,10 +817,7 @@ def _set_order_of_magnitude(self):
if self.offset:
oom = math.floor(math.log10(vmax - vmin))
else:
if locs[0] > locs[-1]:
val = locs[0]
else:
val = locs[-1]
val = locs.max()
if val == 0:
oom = 0
else:
Expand Down