File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 11from collections import deque
22import json
3- import os
43import uuid
54
65# TODO: protected imports?
76from IPython .html import widgets
87from IPython .utils .traitlets import Unicode
98from IPython .display import Javascript , display
109
11- from plotly import utils
10+ from plotly import utils , tools
1211from pkg_resources import resource_string
1312
1413# Load JS widget code
@@ -247,6 +246,18 @@ def message_handler(widget, ranges):
247246 """
248247 self ._handle_registration ('zoom' , callback , remove )
249248
249+ def plot (self , figure_or_data , validate = True ):
250+ """Plot figure_or_data in the Plotly graph.
251+ """
252+ figure = tools .return_figure_from_figure_or_data (figure_or_data , validate )
253+ message = {
254+ 'task' : 'newPlot' ,
255+ 'data' : figure ['data' ],
256+ 'layout' : figure .get ('layout' , {}),
257+ 'graphId' : self ._graphId
258+ }
259+ self ._handle_outgoing_message (message )
260+
250261 def restyle (self , data , indices = None ):
251262 """Update the style of existing traces in the Plotly graph.
252263
You can’t perform that action at this time.
0 commit comments