spacepy.plot.utils.shared_ylabel — SpacePy v0.1.5 Manual

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- plot - Plot, various specialized plotting functions and associated utilities »
- spacepy.plot.utils »

# spacepy.plot.utils.shared_ylabel

`spacepy.plot.utils.` `shared_ylabel`(axes, txt, *args, **kwargs)

  Create a ylabel that spans several subplots

  Useful for a multi-panel plot where several subplots have the same units/quantities on the y axis.

  Parameters: | axes : list The `Axes` objects (i.e. subplots) which should share a single label txt : str The label to place in the middle of all the ``axes` objects.
  Returns: | out : matplotlib.text.Text The `Text` object for the label.
  Other Parameters:
  | Additional arguments and keywords are passed through to : :meth:`~matplotlib.axes.Axes.set_ylabel` :

  Notes

  This function can be fairly fragile and should only be used for fairly simple layouts, e.g., a one-column multi-row plot stack.

  The label is associated with the bottommost subplot in `axes`.

  Examples

      >>> import spacepy.plot.utils
      >>> import matplotlib.pyplot as plt
      >>> fig = plt.figure()
      >>> #Make three stacked subplots
      >>> ax0 = fig.add_subplot(311)
      >>> ax1 = fig.add_subplot(312)
      >>> ax2 = fig.add_subplot(313)
      >>> ax0.plot([1, 2, 3], [1, 2, 1]) #just make some lines
      [<matplotlib.lines.Line2D object at 0x0000000>]
      >>> ax1.plot([1, 2, 3], [1, 2, 1])
      [<matplotlib.lines.Line2D object at 0x0000000>]
      >>> ax2.plot([1, 2, 3], [1, 2, 1])
      [<matplotlib.lines.Line2D object at 0x0000000>]
      >>> #Create a green label across all three axes
      >>> spacepy.plot.utils.shared_ylabel([ax0, ax1, ax2],
      ... 'this is a very long label that spans all three axes', color='g')

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- homepage|
- search|
- documentation »
- plot - Plot, various specialized plotting functions and associated utilities »
- spacepy.plot.utils »