Skip to content

Commit

Permalink
Merge pull request #130 from alurban/texify
Browse files Browse the repository at this point in the history
Use gwdetchar.plot.texify for LaTeX escape characters
  • Loading branch information
Alex L. Urban authored Nov 4, 2019
2 parents cde2273 + b0726cc commit abe3517
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 2 additions & 4 deletions bin/hveto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ from gwpy.segments import (Segment, SegmentList,
from gwdetchar import cli
from gwdetchar.io.html import (FancyPlot, cis_link)
from gwdetchar.omega import batch
from gwdetchar.plot import texify

from hveto import (__version__, config, core, plot, html, utils)
from hveto.plot import (HEADER_CAPTION, ROUND_CAPTION, get_column_label)
Expand Down Expand Up @@ -576,10 +577,7 @@ cum. deadtime : %s\n\n""" % (

pngname = os.path.join(plotdir, '%s-HVETO_%%s_ROUND_%d-%d-%d.png' % (
ifo, round.n, start, duration))
if plot.rcParams['text.usetex']:
wname = round.winner.name.replace('_', r'\_')
else:
wname = round.winner.name
wname = texify(round.winner.name)
beforel = 'Before\n[%d]' % len(before)
afterl = 'After\n[%d]' % len(primary)
vetoedl = 'Vetoed\n(primary)\n[%d]' % len(vetoed)
Expand Down
9 changes: 5 additions & 4 deletions hveto/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

from gwpy.plot import Plot

from gwdetchar.plot import texify

__author__ = 'Duncan Macleod <[email protected]>'
__credits__ = 'Josh Smith, Joe Areeda, Alex Urban'

Expand Down Expand Up @@ -382,8 +384,7 @@ def significance_drop(outfile, old, new, show_channel_names=None, **kwargs):
# set xticks to show channel names
if show_channel_names:
ax.set_xticks(range(len(channels)))
ax.set_xticklabels([c.replace('_', '\_')
for c in channels]) # noqa: W605
ax.set_xticklabels([texify(c) for c in channels])
for i, t in enumerate(ax.get_xticklabels()):
t.set_rotation(270)
t.set_verticalalignment('top')
Expand Down Expand Up @@ -431,8 +432,8 @@ def significance_drop(outfile, old, new, show_channel_names=None, **kwargs):
ha = 'center'
y = l.get_ydata()[0] + yoffset
c = l.get_label()
tooltips.append(ax.annotate(c.replace('_', r'\_'), (x, y),
ha=ha, zorder=ylim[1], bbox=bbox))
tooltips.append(ax.annotate(texify(c), (x, y), ha=ha,
zorder=ylim[1], bbox=bbox))
l.set_gid('line-%d' % i)
tooltips[-1].set_gid('tooltip-%d' % i)

Expand Down

0 comments on commit abe3517

Please sign in to comment.