diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 3e782204..d1e64a9b 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -2344,6 +2344,9 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', data2 ) + ymean1 = data1['y1'].mean() + ymean2 = data2['y2'].mean() + # create interactive plot plot = Figure(x_axis_type=x_axis_type,y_axis_type=y_axis_type, tools=TOOLS, @@ -2412,6 +2415,25 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', plot.xaxis.axis_label = axlabels[xparam] plot.yaxis.axis_label = axlabels[yparam] + ylabel1 = Label(x=100,y=90,x_units='screen',y_units='screen', + text=axlabels[yparam]+": {ymean1:6.2f}".format( + ymean1=ymean1 + ), + background_fill_alpha=.7, + background_fill_color='white', + text_color='blue' + ) + ylabel2 = Label(x=100,y=110,x_units='screen',y_units='screen', + text=axlabels[yparam]+": {ymean2:6.2f}".format( + ymean2=ymean2 + ), + background_fill_alpha=.7, + background_fill_color='white', + text_color='red' + ) + plot.add_layout(ylabel1) + plot.add_layout(ylabel2) + if xparam == 'time': plot.xaxis[0].formatter = DatetimeTickFormatter( hours = ["%H"],