@@ -84,7 +84,8 @@ def in_ipynb():
84
84
active_plotting_tasks = dict ()
85
85
86
86
87
- def live_plot (runner , * , plotter = None , update_interval = 2 , name = None ):
87
+ def live_plot (runner , * , plotter = None , update_interval = 2 ,
88
+ name = None , normalize = True ):
88
89
"""Live plotting of the learner's data.
89
90
90
91
Parameters
@@ -99,15 +100,19 @@ def live_plot(runner, *, plotter=None, update_interval=2, name=None):
99
100
Name for the `live_plot` task in `adaptive.active_plotting_tasks`.
100
101
By default the name is None and if another task with the same name
101
102
already exists that other `live_plot` is canceled.
103
+ normalize : bool
104
+ Normalize the frame upon each update.
102
105
103
106
Returns
104
107
-------
105
108
dm : `holoviews.core.DynamicMap`
106
109
The plot that automatically updates every `update_interval`.
107
110
"""
108
111
if not _holoviews_enabled :
109
- raise RuntimeError ("Live plotting is not enabled; did you run "
110
- "'adaptive.notebook_extension()'?" )
112
+ raise RuntimeError (
113
+ "Live plotting is not enabled; did you run "
114
+ "'adaptive.notebook_extension()'?"
115
+ )
111
116
112
117
import holoviews as hv
113
118
import ipywidgets
@@ -123,8 +128,10 @@ def plot_generator():
123
128
else :
124
129
yield plotter (runner .learner )
125
130
126
- dm = hv .DynamicMap (plot_generator (),
127
- streams = [hv .streams .Stream .define ('Next' )()])
131
+ steams = [hv .streams .Stream .define ("Next" )()]
132
+ dm = hv .DynamicMap (plot_generator (), streams = streams ).opts (
133
+ norm = dict (framewise = normalize )
134
+
128
135
cancel_button = ipywidgets .Button (description = 'cancel live-plot' ,
129
136
layout = ipywidgets .Layout (width = '150px' ))
130
137
0 commit comments