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

Commit 92a0ffc

Browse filesBrowse files
authored
Merge pull request #24991 from oscargus/sharedlogaxis
Fix issue with shared log axis
2 parents e240080 + 63a83da commit 92a0ffc
Copy full SHA for 92a0ffc

File tree

Expand file treeCollapse file tree

2 files changed

+15
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+15
-1
lines changed

‎lib/matplotlib/tests/test_ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_ticker.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,19 @@ def test_tick_values_not_empty(self):
259259
1.e+09, 2.e+09, 5.e+09])
260260
assert_almost_equal(ll.tick_values(1, 1e8), test_value)
261261

262+
def test_multiple_shared_axes(self):
263+
rng = np.random.default_rng(19680801)
264+
dummy_data = [rng.normal(size=100), [], []]
265+
fig, axes = plt.subplots(len(dummy_data), sharex=True, sharey=True)
266+
267+
for ax, data in zip(axes.flatten(), dummy_data):
268+
ax.hist(data, bins=10)
269+
ax.set_yscale('log', nonpositive='clip')
270+
271+
for ax in axes.flatten():
272+
assert all(ax.get_yticks() == axes[0].get_yticks())
273+
assert ax.get_ylim() == axes[0].get_ylim()
274+
262275

263276
class TestNullLocator:
264277
def test_set_params(self):

‎lib/matplotlib/ticker.py

Copy file name to clipboardExpand all lines: lib/matplotlib/ticker.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2404,7 +2404,8 @@ def nonsingular(self, vmin, vmax):
24042404
"log-scaled.")
24052405
vmin, vmax = 1, 10
24062406
else:
2407-
minpos = self.axis.get_minpos()
2407+
# Consider shared axises
2408+
minpos = min(axis.get_minpos() for axis in self.axis._get_shared_axis())
24082409
if not np.isfinite(minpos):
24092410
minpos = 1e-300 # This should never take effect.
24102411
if vmin <= 0:

0 commit comments

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