patch.get_path()._interpolation_steps = 100 return patch def cla(self): super().cla() self.patch.set_transform( self.get_grid_helper().grid_finder.get_transform() + self.transData) # The original patch is not in the draw tree; it is only used for # clipping purposes. orig_patch = super()._gen_axes_patch() orig_patch.set_figure(self.figure) orig_patch.set_transform(self.transAxes) self.patch.set_clip_path(orig_patch) self.gridlines.set_clip_path(orig_patch) def adjust_axes_lim(self): bbox = self.patch.get_path().get_extents( # First transform to pixel coords, then to parent data coords. self.patch.get_transform() - self.transData) bbox = bbox.expanded(1.02, 1.02) self.set_xlim(bbox.xmin, bbox.xmax) self.set_ylim(bbox.ymin, bbox.ymax) floatingaxes_class_factory = cbook._make_class_factory(FloatingAxesBase, "Floating{}") FloatingAxes = floatingaxes_class_factory( host_axes_class_factory(axislines.Axes)) FloatingSubplot = maxes.subplot_class_factory(FloatingAxes)
elif mode == "equal": self.axes.viewLim.set(viewlim) elif mode == "transform": self.axes.viewLim.set(viewlim.transformed( self.transAux.inverted())) else: _api.check_in_list([None, "equal", "transform"], mode=mode) def apply_aspect(self, position=None): self._update_viewlim() super().apply_aspect() # end of aux_transform support parasite_axes_class_factory = cbook._make_class_factory( ParasiteAxesBase, "{}Parasite") ParasiteAxes = parasite_axes_class_factory(Axes) class HostAxesBase: def __init__(self, *args, **kwargs): self.parasites = [] super().__init__(*args, **kwargs) def get_aux_axes(self, tr=None, viewlim_mode="equal", axes_class=Axes): """ Add a parasite axes to this host. Despite this method's name, this should actually be thought of as an ``add_parasite_axes`` method.
if not ss.is_first_col(): # Remove left label/ticklabels/offsettext. if label_position == "left": self.set_ylabel("") self.yaxis.set_tick_params(which="both", labelleft=False) if self.yaxis.offsetText.get_position()[0] == 0: self.yaxis.offsetText.set_visible(False) if not ss.is_last_col(): # Remove right label/ticklabels/offsettext. if label_position == "right": self.set_ylabel("") self.yaxis.set_tick_params(which="both", labelright=False) if self.yaxis.offsetText.get_position()[0] == 1: self.yaxis.offsetText.set_visible(False) def _make_twin_axes(self, *args, **kwargs): """Make a twinx axes of self. This is used for twinx and twiny.""" if 'sharex' in kwargs and 'sharey' in kwargs: # The following line is added in v2.2 to avoid breaking Seaborn, # which currently uses this internal API. if kwargs["sharex"] is not self and kwargs["sharey"] is not self: raise ValueError("Twinned Axes may share only one axis") twin = self.figure.add_subplot(self.get_subplotspec(), *args, **kwargs) self.set_adjustable('datalim') twin.set_adjustable('datalim') self._twinned_axes.join(self, twin) return twin subplot_class_factory = cbook._make_class_factory(SubplotBase, "{}Subplot", "_axes_class") Subplot = subplot_class_factory(Axes) # Provided for backward compatibility.
self._default_label_on = b axis = self.axis[self.orientation] axis.toggle(ticklabels=b, label=b) def cla(self): orientation = self.orientation super().cla() self.orientation = orientation @_api.deprecated("3.5") class CbarAxes(CbarAxesBase, Axes): pass _cbaraxes_class_factory = cbook._make_class_factory(CbarAxesBase, "Cbar{}") class Grid: """ A grid of Axes. In Matplotlib, the axes location (and size) is specified in normalized figure coordinates. This may not be ideal for images that needs to be displayed with a given aspect ratio; for example, it is difficult to display multiple images of a same size with some fixed padding between them. AxesGrid can be used in such case. """ _defaultAxesClass = Axes