Skip to content

Commit

Permalink
Add option to update legend in main figure using items from ratio plot
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Marley committed Sep 14, 2018
1 parent 1f2078a commit 1d78e7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/histogram1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ def plotRatio(self):
formatter = FormatStrFormatter('%g')
self.ax2.set_yticklabels(np.array([formatter(i) for i in axis_ticks]))

if self.ratio.update_legend:
extra_handles,extra_labels = self.ax2.get_legend_handles_labels()
self.legend['extra_handles'] = extra_handles
self.legend['extra_labels'] = extra_labels

return


Expand Down Expand Up @@ -365,6 +370,7 @@ def __init__(self):
self.ylim = None
self.yticks = None
self.ylabel = ''
self.update_legend = False # add ratio values to legend on main plot

def initialize(self):
"""Set some default options if not set by the user"""
Expand Down

0 comments on commit 1d78e7e

Please sign in to comment.