MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / toggle

Method toggle

lib/mpl_toolkits/axes_grid1/mpl_axes.py:99–128  ·  view source on GitHub ↗
(self, all=None, ticks=None, ticklabels=None, label=None)

Source from the content-addressed store, hash-verified

97 self._axis.set_label_text(txt)
98
99 def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
100
101 if all:
102 _ticks, _ticklabels, _label = True, True, True
103 elif all is not None:
104 _ticks, _ticklabels, _label = False, False, False
105 else:
106 _ticks, _ticklabels, _label = None, None, None
107
108 if ticks is not None:
109 _ticks = ticks
110 if ticklabels is not None:
111 _ticklabels = ticklabels
112 if label is not None:
113 _label = label
114
115 if _ticks is not None:
116 tickparam = {f"tick{self._axisnum}On": _ticks}
117 self._axis.set_tick_params(**tickparam)
118 if _ticklabels is not None:
119 tickparam = {f"label{self._axisnum}On": _ticklabels}
120 self._axis.set_tick_params(**tickparam)
121
122 if _label is not None:
123 pos = self._axis.get_label_position()
124 if (pos == self._axis_direction) and not _label:
125 self._axis.label.set_visible(False)
126 elif _label:
127 self._axis.label.set_visible(True)
128 self._axis.set_label_position(self._axis_direction)

Callers 3

set_label_modeMethod · 0.95
set_visibleMethod · 0.95
_remove_any_twinMethod · 0.45

Calls 4

set_tick_paramsMethod · 0.80
get_label_positionMethod · 0.45
set_visibleMethod · 0.45
set_label_positionMethod · 0.45

Tested by

no test coverage detected