10000 Hide "inner" {x,y}labels in label_outer too. by anntzer · Pull Request #6619 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Hide "inner" {x,y}labels in label_outer too. #6619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2016
Merged
Changes from 1 commit
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
Next Next commit
Hide "inner" {x,y}labels in label_outer too.
`ax.label_outer` used to hide only "inner" ticklabels; make it hide axes
labels too.  (I couldn't find a way to just switch label visibility, so
I just set the labels to the empty string instead.)
  • Loading branch information
anntzer committed Jun 21, 2016
commit 27d669c5a7d0b111ee826a397a4fb14a3a822294
12 changes: 8 additions & 4 deletions lib/matplotlib/axes/_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,23 @@ def is_last_col(self):

# COVERAGE NOTE: Never used internally or from examples
def label_outer(self):
"""
set the visible property on ticklabels so xticklabels are
visible only if the subplot is in the last row and yticklabels
are visible only if the subplot is in the first column
"""Only show "outer" labels and tick labels.

x-labels are only kept for subplots on the last row; y-labels only for
subplots on the first column.
"""
lastrow = self.is_last_row()
firstcol = self.is_first_col()
for label in self.get_xticklabels():
label.set_visible(lastrow)
self.get_xaxis().get_offset_text().set_visible(lastrow)
if not lastrow:
self.set_xlabel("")
for label in self.get_yticklabels():
label.set_visible(firstcol)
self.get_yaxis().get_offset_text().set_visible(firstcol)
if not firstcol:
self.set_ylabel("")

def _make_twin_axes(self, *kl, **kwargs):
"""
Expand Down
0