def plot_flag(self, flag, y=None, **kwargs):
<EOL>if y is None:<EOL><INDENT>y = self.get_next_y()<EOL><DEDENT>if flag.isgood:<EOL><INDENT>kwargs.setdefault('<STR_LIT>', '<STR_LIT>')<EOL>kwargs.setdefault('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>kwargs.setdefault('<STR_LIT>', '<STR_LIT>')<EOL>kwargs.setdefault('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>known = kwargs.pop('<STR_LIT>')<EOL>name = kwargs.pop('<STR_LIT:label>', flag.label or flag.name)<EOL>kwargs.setdefault('<STR_LIT>', <NUM_LIT:0>)<EOL>coll = self.plot_segmentlist(flag.active, y=y, label=name,<EOL>**kwargs)<EOL>if known not in (None, False):<EOL><INDENT>known_kw = {<EOL>'<STR_LIT>': coll.get_facecolor()[<NUM_LIT:0>],<EOL>'<STR_LIT>': '<STR_LIT:ignore>',<EOL>'<STR_LIT>': -<NUM_LIT:1000>,<EOL>}<EOL>if isinstance(known, dict):<EOL><INDENT>known_kw.update(known)<EOL><DEDENT>elif known == '<STR_LIT>':<EOL><INDENT>known_kw.update(height=kwargs.get('<STR_LIT>', <NUM_LIT>)*<NUM_LIT>)<EOL><DEDENT>elif known in HATCHES:<EOL><INDENT>known_kw.update(fill=False, hatch=known)<EOL><DEDENT>else:<EOL><INDENT>known_kw.update(fill=True, facecolor=known,<EOL>height=kwargs.get('<STR_LIT>', <NUM_LIT>)*<NUM_LIT>)<EOL><DEDENT>self.plot_segmentlist(flag.known, y=y, label=name, **known_kw)<EOL><DEDENT>return coll<EOL>
Plot a `~gwpy.segments.DataQualityFlag` onto these axes.

        Parameters
        ----------
        flag : `~gwpy.segments.DataQualityFlag`
            Data-quality flag to display.

        y : `float`, optional
            Y-axis value for new segments.

        height : `float`, optional,
            Height for each segment, default: `0.8`.

        known : `str`, `dict`, `None`
            One of the following

            - ``'fancy'`` - to use fancy format (try it and see)
            - ``'x'`` (or similar) - to use hatching
            - `str` to specify ``facecolor`` for known segmentlist
            - `dict` of kwargs to use
            - `None` to ignore known segmentlist

        **kwargs
            Any other keyword arguments acceptable for
            `~matplotlib.patches.Rectangle`.

        Returns
        -------
        collection : `~matplotlib.patches.PatchCollection`
            list of `~matplotlib.patches.Rectangle` patches for active
            segments