Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit67b42d8

Browse files
committed
Don't hide shared "x/y"ticklabels for grids of non-rectilinear axes.
In particular, hiding the "x/y" (i.e. theta/r) ticklabels doesn't makesense for polar axes, and I'd guess likewise for most projections otherthan the default rectilinear. Try e.g.`subplots(2, 2, subplot_kw=dict(projection="polar"), sharex=True, sharey=True)`.
1 parentcb756d3 commit67b42d8

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

‎lib/matplotlib/gridspec.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,13 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True,
308308
self[row,col],**subplot_kw)
309309

310310
# turn off redundant tick labeling
311-
ifsharexin ["col","all"]:
312-
foraxinaxarr.flat:
313-
ax._label_outer_xaxis()
314-
ifshareyin ["row","all"]:
315-
foraxinaxarr.flat:
316-
ax._label_outer_yaxis()
311+
ifall(ax.name=="rectilinear"foraxinaxarr.flat):
312+
ifsharexin ["col","all"]:
313+
foraxinaxarr.flat:
314+
ax._label_outer_xaxis()
315+
ifshareyin ["row","all"]:
316+
foraxinaxarr.flat:
317+
ax._label_outer_yaxis()
317318

318319
ifsqueeze:
319320
# Discarding unneeded dimensions that equal 1. If we only have one

‎lib/matplotlib/tests/test_polar.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,10 @@ def test_remove_shared_polar(fig_ref, fig_test):
394394
2,2,sharey=True,subplot_kw={"projection":"polar"})
395395
foriin [0,1,3]:
396396
axs.flat[i].remove()
397+
398+
399+
deftest_shared_polar_keeps_ticklabels():
400+
_,axs=plt.subplots(
401+
2,2,subplot_kw=dict(projection="polar"),sharex=True,sharey=True)
402+
assertaxs[0,1].xaxis._major_tick_kw["label1On"]
403+
assertaxs[0,1].yaxis._major_tick_kw["label1On"]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp