Exemplo n.º 1
0
 def __init__(self, bbox_to_anchor, x_size, y_size, loc, borderpad=0.5, bbox_transform=None):
     self.axes = None
     self.x_size = Size.from_any(x_size)
     self.y_size = Size.from_any(y_size)
     super(AnchoredSizeLocator, self).__init__(
         bbox_to_anchor, None, loc, borderpad=borderpad, bbox_transform=bbox_transform
     )
Exemplo n.º 2
0
   def __init__(self, bbox_to_anchor, x_size, y_size, loc,
                borderpad=0.5, bbox_transform=None):

      self.axes = None
      self.x_size = Size.from_any(x_size)
      self.y_size = Size.from_any(y_size)

      super(AnchoredSizeLocator, self).__init__(bbox_to_anchor, None, loc,
                                                borderpad=borderpad,
                                                bbox_transform=bbox_transform)
Exemplo n.º 3
0
    def new_horizontal(self, size, pad=None, pack_start=False, **kwargs):
        """
        Add a new axes on the right (or left) side of the main axes.

        :param size: A width of the axes. A :mod:`~mpl_toolkits.axes_grid.axes_size`
          instance or if float or string is given, *from_any*
          fucntion is used to create one, with *ref_size* set to AxesX instance
          of the current axes.
        :param pad: pad between the axes. It takes same argument as *size*.
        :param pack_start: If False, the new axes is appended at the end
          of the list, i.e., it became the right-most axes. If True, it is
          inseted at the start of the list, and becomes the left-most axes.

        All extra keywords argument is passed to when creating a axes.
        if *axes_class* is given, the new axes will be created as an
        instance of the given class. Otherwise, the same class of the
        main axes will be used.  if Not provided

        """

        if pad:
            if not isinstance(pad, Size._Base):
                pad = Size.from_any(pad,
                                    fraction_ref=self._xref)
            if pack_start:
                self._horizontal.insert(0, pad)
                self._xrefindex += 1
            else:
                self._horizontal.append(pad)

        if not isinstance(size, Size._Base):
            size = Size.from_any(size,
                                 fraction_ref=self._xref)

        if pack_start:
            self._horizontal.insert(0, pad)
            self._xrefindex += 1
            locator = self.new_locator(nx=0, ny=0)
        else:
            self._horizontal.append(size)
            locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)

        ax = self._get_new_axes(**kwargs)
        locator = self.new_locator(nx=len(self._horizontal)-1, ny=0)
        ax.set_axes_locator(locator)

        return ax
Exemplo n.º 4
0
    def new_vertical(self, size, pad=None, pack_start=False, **kwargs):
        """
        Add a new axes on the top (or bottom) side of the main axes.

        :param size: A height of the axes. A :mod:`~mpl_toolkits.axes_grid.axes_size`
          instance or if float or string is given, *from_any*
          fucntion is used to create one, with *ref_size* set to AxesX instance
          of the current axes.
        :param pad: pad between the axes. It takes same argument as *size*.
        :param pack_start: If False, the new axes is appended at the end
          of the list, i.e., it became the top-most axes. If True, it is
          inseted at the start of the list, and becomes the bottom-most axes.

        All extra keywords argument is passed to when creating a axes.
        if *axes_class* is given, the new axes will be created as an
        instance of the given class. Otherwise, the same class of the
        main axes will be used.  if Not provided

        """

        if pad:
            if not isinstance(pad, Size._Base):
                pad = Size.from_any(pad,
                                    fraction_ref=self._yref)
            if pack_start:
                self._vertical.insert(0, pad)
                self._yrefindex += 1
            else:
                self._vertical.append(pad)

        if not isinstance(size, Size._Base):
            size = Size.from_any(size,
                                 fraction_ref=self._yref)

        if pack_start:
            self._vertical.insert(0, size)
            self._yrefindex += 1
            locator = self.new_locator(nx=0, ny=0)
        else:
            self._vertical.append(size)
            locator = self.new_locator(nx=0, ny=len(self._vertical)-1)

        ax = self._get_new_axes(**kwargs)
        ax.set_axes_locator(locator)

        return ax