How to use the gwpy.plot.tex.label_to_latex function in gwpy

To help you get started, we’ve selected a few gwpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gwpy / gwpy / gwpy / cli / spectrum.py View on Github external
nlegargs = 0  # don't use  themm

        for i in range(0, self.n_datasets):
            series = self.timeseries[i]
            if nlegargs:
                label = self.args.legend[0][i]
            else:
                label = series.channel.name
                if len(self.start_list) > 1:
                    label += ', {0}'.format(series.epoch.gps)

            asd = series.asd(fftlength=fftlength, overlap=overlap)
            self.spectra.append(asd)

            if self.usetex:
                label = label_to_latex(label)

            ax.plot(asd, label=label)

        if args.xscale == 'log' and not args.xmin:
            args.xmin = 1/fftlength

        return plot
github gwpy / gwpy / gwpy / cli / cliproduct.py View on Github external
def set_suptitle(self, suptitle):
        """Set the super title for this plot.
        """
        if not suptitle:
            suptitle = self.get_suptitle()
        if self.usetex:
            suptitle = label_to_latex(suptitle)
        self.plot.suptitle(suptitle, fontsize=18)
        self.log(3, ('Super title is: %s' % suptitle))
github gwpy / gwpy / gwpy / table / table.py View on Github external
if args[0].name == tcol:  # map X column to GPS axis
            kwargs.setdefault('figsize', (12, 6))
            kwargs.setdefault('xscale', 'auto-gps')

        kwargs['method'] = method
        plot = Plot(*args, **kwargs)

        # set default labels
        ax = plot.gca()
        for axis, col in zip(
                filter(attrgetter('isDefault_label'), (ax.xaxis, ax.yaxis)),
                args[:2],
        ):
            name = col.name
            if rcParams['text.usetex']:
                name = r'\texttt{{{0}}}'.format(label_to_latex(col.name))
            if col.unit is not None:
                name += ' [{0}]'.format(col.unit.to_string('latex_inline'))
            axis.set_label_text(name)
            axis.isDefault_label = True

        return plot
github gwpy / gwpy / gwpy / cli / cliproduct.py View on Github external
_set('lim', *limits)

        # set scale
        if scale:
            _set('scale', scale)

        # reset scale with epoch if using GPS scale
        if _get('scale') in GPS_SCALES:
            _set('scale', scale, epoch=self.args.epoch)

        # set label
        if label is None:
            label = getattr(self, 'get_{}label'.format(axis))()
        if label:
            if self.usetex:
                label = label_to_latex(label)
            _set('label', label)

        # log
        limits = _get('lim')
        scale = _get('scale')
        label = _get('label')
        self.log(2, '{0}-axis parameters | scale: {1} | '
                    'limits: {2[0]!s} - {2[1]!s}'.format(
                        axis.upper(), scale, limits))
        self.log(3, ('{0}-axis label: {1}'.format(axis.upper(), label)))
github gwpy / gwpy / gwpy / cli / cliproduct.py View on Github external
def set_title(self, title):
        """Set the title(s) for this plot.

        The `Axes.title` actually serves at the sub-title for the plot,
        typically giving processing parameters and information.
        """

        if title is None:
            title_line = self.get_title().rstrip(', ')
        else:
            title_line = title

        if self.usetex:
            title_line = label_to_latex(title_line)
        if title_line:
            self.ax.set_title(title_line, fontsize=12)
            self.log(3, ('Title is: %s' % title_line))
github gwpy / gwpy / gwpy / cli / cliproduct.py View on Github external
def set_title(self, title):
        """Set the title(s) for this plot.

        The `Axes.title` actually serves at the sub-title for the plot,
        typically giving processing parameters and information.
        """

        if title is None:
            title_line = self.get_title().rstrip(', ')
        else:
            title_line = title

        if self.usetex:
            title_line = label_to_latex(title_line)
        if title_line:
            self.ax.set_title(title_line, fontsize=12)
            self.log(3, ('Title is: %s' % title_line))
github gwpy / gwpy / gwpy / cli / coherence.py View on Github external
ax = plot.gca()
        self.spectra = []

        # calculate coherence
        for seg in groups:
            refts = groups[seg].pop(self.ref_chan)
            for name in groups[seg]:
                series = groups[seg][name]
                coh = series.coherence(refts, fftlength=fftlength,
                                       overlap=overlap, window=args.window)

                label = name
                if len(self.start_list) > 1:
                    label += ', {0}'.format(series.epoch.gps)
                if self.usetex:
                    label = label_to_latex(label)

                ax.plot(coh, label=label)
                self.spectra.append(coh)

        if args.xscale == 'log' and not args.xmin:
            args.xmin = 1/fftlength

        return plot