Skip to content
Snippets Groups Projects

Draft: Plot update

Closed Rui Zhang requested to merge plot_update into master
1 file
+ 18
15
Compare changes
  • Side-by-side
  • Inline
@@ -76,7 +76,7 @@ class UpperLimit2DPlot(AbstractPlot):
labels_sec:Optional[Dict]=None,
styles:Optional[Union[Dict, str]]=None,
analysis_label_options:Optional[Union[Dict, str]]='default',
config:Optional[Dict]=None):
config:Optional[Dict]=None, disable_errorband=False):
super().__init__(color_pallete=color_pallete,
color_pallete_sec=color_pallete_sec,
styles=styles,
@@ -93,6 +93,7 @@ class UpperLimit2DPlot(AbstractPlot):
self.curve_data = None
self.highlight_data = None
self.disable_errorband = disable_errorband
def get_default_legend_order(self):
return ['observed', 'expected', '1sigma', '2sigma', 'curve', 'highlight']
@@ -174,18 +175,19 @@ class UpperLimit2DPlot(AbstractPlot):
handles_map = {}
# draw +- 1, 2 sigma bands
handle_2sigma = ax.fill_between(indices, n2sigma_limits, p2sigma_limits,
facecolor=color_pallete['2sigma'],
label=labels['2sigma'],
hatch=sigma_band_hatch,
alpha=alpha)
handle_1sigma = ax.fill_between(indices, n1sigma_limits, p1sigma_limits,
facecolor=color_pallete['1sigma'],
label=labels['1sigma'],
hatch=sigma_band_hatch,
alpha=alpha)
handles_map['1sigma'] = handle_1sigma
handles_map['2sigma'] = handle_2sigma
if not self.disable_errorband:
handle_2sigma = ax.fill_between(indices, n2sigma_limits, p2sigma_limits,
facecolor=color_pallete['2sigma'],
label=labels['2sigma'],
hatch=sigma_band_hatch,
alpha=alpha)
handle_1sigma = ax.fill_between(indices, n1sigma_limits, p1sigma_limits,
facecolor=color_pallete['1sigma'],
label=labels['1sigma'],
hatch=sigma_band_hatch,
alpha=alpha)
handles_map['1sigma'] = handle_1sigma
handles_map['2sigma'] = handle_2sigma
if log:
draw_fn = ax.semilogy
@@ -253,8 +255,9 @@ class UpperLimit2DPlot(AbstractPlot):
# border for the legend
border_leg = patches.Rectangle((0, 0), 1, 1, facecolor = 'none', edgecolor = 'black', linewidth = 1)
self.legend_data['1sigma']['handle'] = (self.legend_data['1sigma']['handle'], border_leg)
self.legend_data['2sigma']['handle'] = (self.legend_data['2sigma']['handle'], border_leg)
if not self.disable_errorband:
self.legend_data['1sigma']['handle'] = (self.legend_data['1sigma']['handle'], border_leg)
self.legend_data['2sigma']['handle'] = (self.legend_data['2sigma']['handle'], border_leg)
if self.curve_data is not None:
if isinstance(self.legend_data['curve']['handle'], tuple):
Loading