Show the areas of a figure which are used/occupied by plot elements.
This function will overplot each element of a plot with a rectangle showing the full bounds of that element, to see for example the margins and such used by a text label.
Returns: | boxes : list of Rectangle
|
---|---|
Other Parameters: | |
fig : matplotlib.figure.Figure
|
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.show_used(fig)
[<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>,
<matplotlib.patches.Rectangle at 0x0000000>]