Skip to content
Snippets Groups Projects

various fixes to the previous plotting updates

Merged Alkaid Cheng requested to merge dev into master
5 files
+ 69
46
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -327,30 +327,6 @@ class AbstractPlot(AbstractObject):
@@ -327,30 +327,6 @@ class AbstractPlot(AbstractObject):
ylabel = "Difference"
ylabel = "Difference"
self.draw_axis_components(ax, xlabel=xlabel, ylabel=ylabel)
self.draw_axis_components(ax, xlabel=xlabel, ylabel=ylabel)
if plot_format == PlotFormat.HIST:
# draw data
hist_y, _, handle = ax.hist(hist_data['x'], bins, range=bin_range,
weights=hist_data['y'], **styles)
assert np.allclose(hist_data['y'], hist_y)
# draw error only
handles = self.draw_binned_data(ax, hist_data,
bin_edges=bin_edges,
draw_data=False,
draw_error=target_show_error,
error_format=error_format,
error_styles=error_styles)
if not isinstance(handle, list):
handle = [handle]
handles = tuple(list(handles) + handle)
elif plot_format == PlotFormat.ERRORBAR:
handles = self.draw_binned_data(ax, hist_data,
bin_edges=bin_edges,
styles=styles,
draw_error=target_show_error,
error_format=error_format,
error_styles=error_styles)
def _draw_hist_from_binned_data(self, ax, x, y,
def _draw_hist_from_binned_data(self, ax, x, y,
xerr=None, yerr=None,
xerr=None, yerr=None,
bin_edges:Optional[np.ndarray]=None,
bin_edges:Optional[np.ndarray]=None,
@@ -609,9 +585,9 @@ class AbstractPlot(AbstractObject):
@@ -609,9 +585,9 @@ class AbstractPlot(AbstractObject):
return handles
return handles
def draw_legend(self, ax, handles=None, labels=None,
def draw_legend(self, ax, handles=None, labels=None,
handler_map=None, **kwargs):
handler_map=None, idx=None, **kwargs):
if (handles is None) and (labels is None):
if (handles is None) and (labels is None):
handles, labels = self.get_legend_handles_labels()
handles, labels = self.get_legend_handles_labels(idx=idx)
if handler_map is not None:
if handler_map is not None:
handler_map = {**CUSTOM_HANDLER_MAP, **handler_map}
handler_map = {**CUSTOM_HANDLER_MAP, **handler_map}
else:
else:
Loading