Add an image (logo) to one corner of a plot.
The provided image will be placed in a corner of the plot and sized to maintain its aspect ratio and be as large as possible without overlapping any existing elements of the figure. Thus this should be the last call in constructing a figure.
Parameters: | img : str or numpy.ndarray
|
---|---|
Returns: | (axes, axesimg) : tuple of Axes and AxesImage |
Other Parameters: | |
fig : matplotlib.figure.Figure
pos : str
margin : float
|
Notes
Calls draw() to ensure locations are up to date.
Examples
>>> import spacepy.plot.utils
>>> import matplotlib.pyplot as plt
>>> fig = plt.figure()
>>> ax0 = fig.add_subplot(211)
>>> ax0.plot([1, 2, 3], [1, 2, 1])
[<matplotlib.lines.Line2D at 0x00000000>]
>>> ax1 = fig.add_subplot(212)
>>> ax1.plot([1, 2, 3], [2, 1, 2])
[<matplotlib.lines.Line2D at 0x00000000>]
>>> spacepy.plot.utils.add_logo('logo.png', fig)
(<matplotlib.axes.Axes at 0x00000000>,
<matplotlib.image.AxesImage at 0x00000000>)