Skip to content

Commit

Permalink
Merge pull request #123 from alurban/update-plots
Browse files Browse the repository at this point in the history
Tweak use plot legend and significance-drop plot title
  • Loading branch information
jrsmith02 authored Apr 22, 2019
2 parents b2bf26d + 918aac8 commit 2e45ab8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions bin/hveto
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,9 @@ while True:
# drop
if round.n > 1:
png = (pngname % 'SIG_DROP').replace('.png', '.svg')
plot.significance_drop(png, oldsignificances, newsignificances,
title=title, subtitle=subtitle)
plot.significance_drop(
png, oldsignificances, newsignificances,
title=' | '.join([title, subtitle]), bbox_inches='tight')
logger.debug("Figure written to %s" % png)
png = FancyPlot(png, caption=ROUND_CAPTION['SIG_DROP'])
rounds[-1].plots.append(png)
Expand Down Expand Up @@ -594,14 +595,14 @@ cum. deadtime : %s\n\n""" % (
wname = round.winner.name
beforel = 'Before\n[%d]' % len(before)
afterl = 'After\n[%d]' % len(primary)
vetoedl = 'Vetoed\n[%d]' % len(vetoed)
vetoedl = 'Vetoed\n(primary)\n[%d]' % len(vetoed)
beforeauxl = 'All\n[%d]' % len(beforeaux)
usedl = 'Used\n[%d]' % len(winner.events)
usedl = 'Used\n(aux)\n[%d]' % len(winner.events)
coincl = 'Coinc.\n[%d]' % len(coincs)
title = '%s Hveto round %d' % (ifo, round.n)
ptitle = '%s: primary impact' % title
atitle = '%s: auxiliary use' % title
subtitle = '[%d-%d] | winner: %s' % (start, end, wname)
subtitle = 'winner: %s [%d-%d]' % (wname, start, end)

# before/after histogram
png = pngname % 'HISTOGRAM'
Expand Down
3 changes: 2 additions & 1 deletion hveto/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def _finalize_plot(plot, ax, outfile, bbox_inches=None, close=True, **axargs):
# format axes
for key in axargs:
getattr(ax, 'set_%s' % key)(axargs[key])
# format subtitle first
if subtitle:
pos = list(ax.title.get_position())
pos[1] += 0.05
Expand Down Expand Up @@ -372,7 +373,7 @@ def significance_drop(outfile, old, new, show_channel_names=None, **kwargs):
if show_channel_names is None:
show_channel_names = len(channels) <= 50

plot = Plot(figsize=(18, 6))
plot = Plot(figsize=(20, 5))
plot.subplots_adjust(left=.07, right=.93)
ax = plot.gca()
if show_channel_names:
Expand Down

0 comments on commit 2e45ab8

Please sign in to comment.