### Navigation

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

# spacepy.plot.utils.annotate_xaxis

`spacepy.plot.utils.``annotate_xaxis`(txt, ax=None)

  Write text in-line and to the right of the x-axis tick labels

  Annotates the x axis of an `Axes` object with text placed in-line with the tick labels and immediately to the right of the last label. This is formatted to match the existing tick marks.

  Parameters: | txt : str The annotation text.
  Returns: | out : matplotlib.text.Text The `Text` object for the annotation.
  Other Parameters:
  | ax : matplotlib.axes.Axes The axes to annotate; if not specified, the `gca()` function will be used.

  Notes

  The annotation is placed immediately to the right of the last tick label. Generally the first character of `txt` should be a space to allow some room.

  Calls `draw()` to ensure tick marker locations are up to date.

  Examples

      >>> import spacepy.plot.utils
      >>> import matplotlib.pyplot as plt
      >>> import datetime
      >>> times = [datetime.datetime(2010, 1, 1) + datetime.timedelta(hours=i)
      ...     for i in range(0, 48, 3)]
      >>> plt.plot(times, range(16))
      [<matplotlib.lines.Line2D object at 0x0000000>]
      >>> spacepy.plot.utils.annotate_xaxis(' UT') #mark that times are UT
      <matplotlib.text.Text object at 0x0000000>

### Navigation

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