From f170ba8487f0361cee447d3738808f3a5ae420ed Mon Sep 17 00:00:00 2001 From: xtanion Date: Sun, 12 Mar 2023 17:27:27 +0530 Subject: [PATCH 1/2] fixes bottom and left text appearance --- lib/mpl_toolkits/axes_grid1/axes_grid.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/mpl_toolkits/axes_grid1/axes_grid.py b/lib/mpl_toolkits/axes_grid1/axes_grid.py index 1d6d6265e86f..b9ee7f2e7370 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_grid.py +++ b/lib/mpl_toolkits/axes_grid1/axes_grid.py @@ -32,6 +32,12 @@ def colorbar(self, mappable, *, ticks=None, **kwargs): def toggle_label(self, b): axis = self.axis[self.orientation] + if self.orientation == "top": + b_axis = self.axis["bottom"] + b_axis.toggle(ticklabels=False, label=False) + elif self.orientation == "left": + r_axis = self.axis["right"] + r_axis.toggle(ticklabels=False, label=False) axis.toggle(ticklabels=b, label=b) def cla(self): From 6c9a6408a18f6ac4331c77c89cd612d4e32c60a3 Mon Sep 17 00:00:00 2001 From: xtanion Date: Tue, 14 Mar 2023 22:45:48 +0530 Subject: [PATCH 2/2] updated tick orientation and using dict --- lib/mpl_toolkits/axes_grid1/axes_grid.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/mpl_toolkits/axes_grid1/axes_grid.py b/lib/mpl_toolkits/axes_grid1/axes_grid.py index b9ee7f2e7370..0a5189fe45aa 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_grid.py +++ b/lib/mpl_toolkits/axes_grid1/axes_grid.py @@ -32,13 +32,16 @@ def colorbar(self, mappable, *, ticks=None, **kwargs): def toggle_label(self, b): axis = self.axis[self.orientation] - if self.orientation == "top": - b_axis = self.axis["bottom"] - b_axis.toggle(ticklabels=False, label=False) - elif self.orientation == "left": - r_axis = self.axis["right"] - r_axis.toggle(ticklabels=False, label=False) - axis.toggle(ticklabels=b, label=b) + axis.toggle(ticks=b, ticklabels=b, label=b) + opposite_axis = { + 'top': 'bottom', + 'bottom': 'top', + 'right': 'left', + 'left': 'right' + } + + _axis = self.axis[opposite_axis.get(self.orientation)] + _axis.toggle(ticks=False, ticklabels=False, label=False) def cla(self): orientation = self.orientation