def add_axes(self, *args, **kwargs): """ Add an a axes with axes rect [*left*, *bottom*, *width*, *height*] where all quantities are in fractions of figure width and height. kwargs are legal :class:`~matplotlib.axes.Axes` kwargs plus *projection* which sets the projection type of the axes. (For backward compatibility, ``polar=True`` may also be provided, which is equivalent to ``projection='polar'``). Valid values for *projection* are: %(projection_names)s. Some of these projections support additional kwargs, which may be provided to :meth:`add_axes`:: rect = l,b,w,h fig.add_axes(rect) fig.add_axes(rect, frameon=False, axisbg='g') fig.add_axes(rect, polar=True) fig.add_axes(rect, projection='polar') fig.add_axes(ax) # add an Axes instance If the figure already has an axes with the same parameters, then it will simply make that axes current and return it. If you do not want this behavior, eg. you want to force the creation of a new axes, you must use a unique set of args and kwargs. The axes :attr:`~matplotlib.axes.Axes.label` attribute has been exposed for this purpose. Eg., if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels:: fig.add_axes(rect, label='axes1') fig.add_axes(rect, label='axes2') The :class:`~matplotlib.axes.Axes` instance will be returned. The following kwargs are supported: %(Axes)s """ key = self._make_key(*args, **kwargs) if key in self._seen: ax = self._seen[key] self.sca(ax) return ax if not len(args): return if isinstance(args[0], Axes): a = args[0] assert a.get_figure() is self else: rect = args[0] ispolar = kwargs.pop("polar", False) projection = kwargs.pop("projection", None) if ispolar: if projection is not None and projection != "polar": raise ValueError( "polar=True, yet projection='%s'. " + "Only one of these arguments should be supplied." % projection ) projection = "polar" a = projection_factory(projection, self, rect, **kwargs) self.axes.append(a) self._axstack.push(a) self.sca(a) self._seen[key] = a return a
def add_axes(self, *args, **kwargs): """ Add an axes at position *rect* [*left*, *bottom*, *width*, *height*] where all quantities are in fractions of figure width and height. kwargs are legal :class:`~matplotlib.axes.Axes` kwargs plus *projection* which sets the projection type of the axes. (For backward compatibility, ``polar=True`` may also be provided, which is equivalent to ``projection='polar'``). Valid values for *projection* are: %(projection_names)s. Some of these projections support additional kwargs, which may be provided to :meth:`add_axes`. Typical usage:: rect = l,b,w,h fig.add_axes(rect) fig.add_axes(rect, frameon=False, axisbg='g') fig.add_axes(rect, polar=True) fig.add_axes(rect, projection='polar') fig.add_axes(ax) If the figure already has an axes with the same parameters, then it will simply make that axes current and return it. If you do not want this behavior, e.g. you want to force the creation of a new Axes, you must use a unique set of args and kwargs. The axes :attr:`~matplotlib.axes.Axes.label` attribute has been exposed for this purpose. Eg., if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels:: fig.add_axes(rect, label='axes1') fig.add_axes(rect, label='axes2') In rare circumstances, add_axes may be called with a single argument, an Axes instance already created in the present figure but not in the figure's list of axes. For example, if an axes has been removed with :meth:`delaxes`, it can be restored with:: fig.add_axes(ax) In all cases, the :class:`~matplotlib.axes.Axes` instance will be returned. In addition to *projection*, the following kwargs are supported: %(Axes)s """ if not len(args): return key = self._make_key(*args, **kwargs) ax = self._axstack.get(key) if ax is not None: self.sca(ax) return ax if isinstance(args[0], Axes): a = args[0] assert (a.get_figure() is self) else: rect = args[0] ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: if projection is not None and projection != 'polar': raise ValueError( "polar=True, yet projection='%s'. " + "Only one of these arguments should be supplied." % projection) projection = 'polar' a = projection_factory(projection, self, rect, **kwargs) self._axstack.add(key, a) self.sca(a) return a
def add_axes(self, *args, **kwargs): """ Add an axes at position *rect* [*left*, *bottom*, *width*, *height*] where all quantities are in fractions of figure width and height. kwargs are legal :class:`~matplotlib.axes.Axes` kwargs plus *projection* which sets the projection type of the axes. (For backward compatibility, ``polar=True`` may also be provided, which is equivalent to ``projection='polar'``). Valid values for *projection* are: %(projection_names)s. Some of these projections support additional kwargs, which may be provided to :meth:`add_axes`. Typical usage:: rect = l,b,w,h fig.add_axes(rect) fig.add_axes(rect, frameon=False, axisbg='g') fig.add_axes(rect, polar=True) fig.add_axes(rect, projection='polar') fig.add_axes(ax) If the figure already has an axes with the same parameters, then it will simply make that axes current and return it. If you do not want this behavior, e.g. you want to force the creation of a new Axes, you must use a unique set of args and kwargs. The axes :attr:`~matplotlib.axes.Axes.label` attribute has been exposed for this purpose. Eg., if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels:: fig.add_axes(rect, label='axes1') fig.add_axes(rect, label='axes2') In rare circumstances, add_axes may be called with a single argument, an Axes instance already created in the present figure but not in the figure's list of axes. For example, if an axes has been removed with :meth:`delaxes`, it can be restored with:: fig.add_axes(ax) In all cases, the :class:`~matplotlib.axes.Axes` instance will be returned. In addition to *projection*, the following kwargs are supported: %(Axes)s """ if not len(args): return key = self._make_key(*args, **kwargs) ax = self._axstack.get(key) if ax is not None: self.sca(ax) return ax if isinstance(args[0], Axes): a = args[0] assert(a.get_figure() is self) else: rect = args[0] ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: if projection is not None and projection != 'polar': raise ValueError( "polar=True, yet projection='%s'. " + "Only one of these arguments should be supplied." % projection) projection = 'polar' a = projection_factory(projection, self, rect, **kwargs) self._axstack.add(key, a) self.sca(a) return a
def add_axes(self, *args, **kwargs): """ Add an a axes with axes rect [*left*, *bottom*, *width*, *height*] where all quantities are in fractions of figure width and height. kwargs are legal :class:`~matplotlib.axes.Axes` kwargs plus *projection* which sets the projection type of the axes. (For backward compatibility, ``polar=True`` may also be provided, which is equivalent to ``projection='polar'``). Valid values for *projection* are: %(list)s. Some of these projections support additional kwargs, which may be provided to :meth:`add_axes`:: rect = l,b,w,h fig.add_axes(rect) fig.add_axes(rect, frameon=False, axisbg='g') fig.add_axes(rect, polar=True) fig.add_axes(rect, projection='polar') fig.add_axes(ax) # add an Axes instance If the figure already has an axes with the same parameters, then it will simply make that axes current and return it. If you do not want this behavior, eg. you want to force the creation of a new axes, you must use a unique set of args and kwargs. The axes :attr:`~matplotlib.axes.Axes.label` attribute has been exposed for this purpose. Eg., if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels:: fig.add_axes(rect, label='axes1') fig.add_axes(rect, label='axes2') The :class:`~matplotlib.axes.Axes` instance will be returned. The following kwargs are supported: %(Axes)s """ key = self._make_key(*args, **kwargs) if key in self._seen: ax = self._seen[key] self.sca(ax) return ax if not len(args): return if isinstance(args[0], Axes): a = args[0] assert (a.get_figure() is self) else: rect = args[0] ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: if projection is not None and projection != 'polar': raise ValueError( "polar=True, yet projection='%s'. " + "Only one of these arguments should be supplied." % projection) projection = 'polar' a = projection_factory(projection, self, rect, **kwargs) self.axes.append(a) self._axstack.push(a) self.sca(a) self._seen[key] = a return a
def add_axes(self, *args, **kwargs): """ Add an a axes with axes rect [left, bottom, width, height] where all quantities are in fractions of figure width and height. kwargs are legal Axes kwargs plus "projection" which sets the projection type of the axes. (For backward compatibility, polar=True may also be provided, which is equivalent to projection='polar'). Valid values for "projection" are: %s. Some of these projections support additional kwargs, which may be provided to add_axes. rect = l,b,w,h add_axes(rect) add_axes(rect, frameon=False, axisbg='g') add_axes(rect, polar=True) add_axes(rect, projection='polar') add_axes(ax) # add an Axes instance If the figure already has an axes with key *args, *kwargs then it will simply make that axes current and return it. If you do not want this behavior, eg you want to force the creation of a new axes, you must use a unique set of args and kwargs. The artist "label" attribute has been exposed for this purpose. Eg, if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels: add_axes(rect, label='axes1') add_axes(rect, label='axes2') The Axes instance will be returned The following kwargs are supported: %s """ % (", ".join(get_projection_names()), '%(Axes)s') key = self._make_key(*args, **kwargs) if self._seen.has_key(key): ax = self._seen[key] self.sca(ax) return ax if not len(args): return if isinstance(args[0], Axes): a = args[0] assert (a.get_figure() is self) else: rect = args[0] ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: if projection is not None and projection != 'polar': raise ValueError( "polar=True, yet projection='%s'. " + "Only one of these arguments should be supplied." % projection) projection = 'polar' a = projection_factory(projection, self, rect, **kwargs) self.axes.append(a) self._axstack.push(a) self.sca(a) self._seen[key] = a return a
def add_axes(self, *args, **kwargs): """ Add an a axes with axes rect [left, bottom, width, height] where all quantities are in fractions of figure width and height. kwargs are legal Axes kwargs plus "projection" which sets the projection type of the axes. (For backward compatibility, polar=True may also be provided, which is equivalent to projection='polar'). Valid values for "projection" are: %s. Some of these projections support additional kwargs, which may be provided to add_axes. rect = l,b,w,h add_axes(rect) add_axes(rect, frameon=False, axisbg='g') add_axes(rect, polar=True) add_axes(rect, projection='polar') add_axes(ax) # add an Axes instance If the figure already has an axes with key *args, *kwargs then it will simply make that axes current and return it. If you do not want this behavior, eg you want to force the creation of a new axes, you must use a unique set of args and kwargs. The artist "label" attribute has been exposed for this purpose. Eg, if you want two axes that are otherwise identical to be added to the figure, make sure you give them unique labels: add_axes(rect, label='axes1') add_axes(rect, label='axes2') The Axes instance will be returned The following kwargs are supported: %s """ % (", ".join(get_projection_names()), '%(Axes)s') key = self._make_key(*args, **kwargs) if self._seen.has_key(key): ax = self._seen[key] self.sca(ax) return ax if not len(args): return if isinstance(args[0], Axes): a = args[0] assert(a.get_figure() is self) else: rect = args[0] ispolar = kwargs.pop('polar', False) projection = kwargs.pop('projection', None) if ispolar: if projection is not None and projection != 'polar': raise ValueError( "polar=True, yet projection='%s'. " + "Only one of these arguments should be supplied." % projection) projection = 'polar' a = projection_factory(projection, self, rect, **kwargs) self.axes.append(a) self._axstack.push(a) self.sca(a) self._seen[key] = a return a