Commit 4125b3e5 authored by Javier Duarte's avatar Javier Duarte
Browse files

separate legend for contours

parent cd7030f2
Pipeline #3672484 skipped with stage
......@@ -419,6 +419,8 @@ def plot_likelihood_scan_2d(
if show_contours_only:
show_significances = (1, 2)
significance_labels = ["68%", "95%"]
else:
significance_labels = ["{:.0f}#sigma".format(signif) for signif in show_significances]
# check values
values = make_list(values)
......@@ -557,6 +559,7 @@ def plot_likelihood_scan_2d(
r.setup_y_axis(h_dummy.GetYaxis(), pad=pad, props={"TitleSize": 30, "LabelSize": 26, "TitleOffset": 1.25})
draw_objs.append((h_dummy, ""))
legend_entries = []
legend2_entries = []
# setup actual histograms
import array
......@@ -610,7 +613,7 @@ def plot_likelihood_scan_2d(
draw_objs.append((g, "SAME,C"))
# stop here when only drawing contours
if show_contours_only:
if show_contours_only or True:
continue
# get the approximate label width
......@@ -699,10 +702,11 @@ def plot_likelihood_scan_2d(
if show_best_fit and scan:
label = "Observed" # if paper else make_bf_label(scan.num1_min, scan.num2_min)
legend_entries.insert(0, (g_fit, label, "PLE" if show_best_fit_error else "P"))
if show_contours_only:
if show_contours_only or True:
for graphs, level in zip(contours, significance_labels):
for g in graphs:
legend_entries.append((g, level, "L"))
legend2_entries.append((g, level, "L"))
break
if legend_entries:
if show_contours_only:
legend = r.routines.create_legend(pad=pad, width=260, n=2,
......@@ -710,8 +714,13 @@ def plot_likelihood_scan_2d(
else:
legend = r.routines.create_legend(pad=pad, width=260, n=len(legend_entries),
props={"TextSize": 24})
legend2 = r.routines.create_legend(pad=pad, x1=20, y1=20, y2=140, width=120, n=len(legend2_entries),
props={"TextSize": 24})
r.fill_legend(legend, legend_entries)
r.fill_legend(legend2, legend2_entries)
draw_objs.append(legend)
draw_objs.append(legend2)
# cms label
cms_layout = "inside_horizontal"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment