spacepy.plot.set_target¶
-
spacepy.plot.
set_target
(target, figsize=None, loc=111, polar=False)[source]¶ Given a target on which to plot a figure, determine if that target is None or a matplotlib figure or axes object. Based on the type of target, a figure and/or axes will be either located or generated. Both the figure and axes objects are returned to the caller for further manipulation. This is used in nearly all add_plot-type methods.
Parameters: target : object
The object on which plotting will happen.
Returns: fig : object
A matplotlib figure object on which to plot.
ax : object
A matplotlib subplot object on which to plot.
Other Parameters: figsize : tuple
A two-item tuple/list giving the dimensions of the figure, in inches. Defaults to Matplotlib defaults.
loc : integer
The subplot triple that specifies the location of the axes object. Defaults to 111.
polar : bool
Set the axes object to polar coodinates. Defaults to False.
Examples
>>> import matplotlib.pyplot as plt >>> from spacepy.pybats import set_target >>> fig = plt.figure() >>> fig, ax = set_target(target=fig, loc=211)