# spacepy.plot.add_logo

`spacepy.plot.``add_logo`(img, fig=None, pos='br', margin=0.05)

  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

      The image to place on the figure. If a string, assumed to be a filename to be read with `imread()`; if a numpy array, assumed to be the image itself (in a simliar format).

  Returns
    (axes, axesimg)tuple of Axes and AxesImage

      The `Axes` object created to hold the iamge, and the `AxesImage` object for the image itself.

  Other Parameters
    fig matplotlib.figure.Figure

      The figure on which to place the logo; if not specified, the `gcf()` function will be used.

    pos str

      The position to place the logo. br: bottom right; bl: bottom left; tl: top left; tr: top right

    margin float

      Margin to include on each side of figure, as a fraction of the larger dimension of the figure (width or height). Default is 0.05 (5%).

  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>)