Skip to content

Commit 1f5bc8c

Browse files
Apply suggestions from code review
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
1 parent e402c91 commit 1f5bc8c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

galleries/users_explain/axes/mosaic.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,20 +420,17 @@ def identify_axes(ax_dict, fontsize=48):
420420
# ---------------------------------
421421
#
422422
# When the mosaic layout has blank spaces (empty sentinels), axis sharing
423-
# can produce unexpected results. In the following example, the top-left
424-
# cell is empty and ``sharey=True`` is used:
423+
# can produce inintended results. In the following example, there are no
424+
# tick labels in the top row:
425425

426426
fig, axd = plt.subplot_mosaic(".A;BC", sharey=True, layout="constrained")
427427
for ax in axd.values():
428428
ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
429429
identify_axes(axd)
430430

431431
# %%
432-
# Because the left column's topmost Axes is blank, Axes ``"B"`` would
433-
# normally be the leftmost visible Axes in its row, but axis sharing has
434-
# already removed its y-axis tick labels (since it is not the first column
435-
# in the grid). As a result, *none* of the Axes in the top row display
436-
# y-axis tick labels, which is usually not what you want.
432+
# The reason for this behavior is that sharing removes tick labels from
433+
# all but the most-left / most-bottom grid positions.
437434
#
438435
# The fix is to manually re-enable tick labels on the Axes that should
439436
# display them using `.Axes.tick_params`:
@@ -442,7 +439,7 @@ def identify_axes(ax_dict, fontsize=48):
442439
for ax in axd.values():
443440
ax.plot([1, 2, 3, 4], [1, 4, 2, 3])
444441

445-
# Re-enable y-axis tick labels on Axes "B"
446-
axd["B"].tick_params(labelleft=True)
442+
# Re-enable y-axis tick labels on Axes "A"
443+
axd["A"].tick_params(labelleft=True)
447444

448445
identify_axes(axd)

0 commit comments

Comments
 (0)