def add_segments_bar(self, segments, ax=None, height=<NUM_LIT>, pad=<NUM_LIT:0.1>,<EOL>sharex=True, location='<STR_LIT>', **plotargs):
<EOL>if not ax:<EOL><INDENT>ax = self.gca()<EOL><DEDENT>axes_kw = {<EOL>'<STR_LIT>': pad,<EOL>'<STR_LIT>': True,<EOL>'<STR_LIT>': ax if sharex is True else sharex or None,<EOL>'<STR_LIT>': get_projection_class('<STR_LIT>'),<EOL>}<EOL>if axes_kw['<STR_LIT>'] is ax and not ax.get_autoscalex_on():<EOL><INDENT>axes_kw['<STR_LIT>'] = ax.get_xlim()<EOL><DEDENT>try:<EOL><INDENT>axes_kw['<STR_LIT>'] = ax.get_epoch()<EOL><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>if ax.get_axes_locator():<EOL><INDENT>divider = ax.get_axes_locator()._axes_divider<EOL><DEDENT>else:<EOL><INDENT>from mpl_toolkits.axes_grid1 import make_axes_locatable<EOL>divider = make_axes_locatable(ax)<EOL><DEDENT>if location not in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>segax = divider.append_axes(location, height, **axes_kw)<EOL>if axes_kw['<STR_LIT>'] is ax and location == '<STR_LIT>':<EOL><INDENT>segax.set_xlabel(ax.get_xlabel())<EOL>segax.xaxis.isDefault_label = ax.xaxis.isDefault_label<EOL>ax.set_xlabel("<STR_LIT>")<EOL>setp(ax.get_xticklabels(), visible=False)<EOL><DEDENT>segax.plot(segments, **plotargs)<EOL>segax.grid(b=False, which='<STR_LIT>', axis='<STR_LIT:y>')<EOL>segax.autoscale(axis='<STR_LIT:y>', tight=True)<EOL>return segax<EOL>
Add a segment bar `Plot` indicating state information.

        By default, segments are displayed in a thin horizontal set of Axes
        sitting immediately below the x-axis of the main,
        similarly to a colorbar.

        Parameters
        ----------
        segments : `~gwpy.segments.DataQualityFlag`
            A data-quality flag, or `SegmentList` denoting state segments
            about this Plot

        ax : `Axes`, optional
            Specific `Axes` relative to which to position new `Axes`,
            defaults to :func:`~matplotlib.pyplot.gca()`

        height : `float, `optional
            Height of the new axes, as a fraction of the anchor axes

        pad : `float`, optional
            Padding between the new axes and the anchor, as a fraction of
            the anchor axes dimension

        sharex : `True`, `~matplotlib.axes.Axes`, optional
            Either `True` to set ``sharex=ax`` for the new segment axes,
            or an `Axes` to use directly

        location : `str`, optional
            Location for new segment axes, defaults to ``'bottom'``,
            acceptable values are ``'top'`` or ``'bottom'``.

        **plotargs
            extra keyword arguments are passed to
            :meth:`~gwpy.plot.SegmentAxes.plot`