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 1
1
from collections import deque
2
2
import json
3
- import os
4
3
import uuid
5
4
6
5
# TODO: protected imports?
7
6
from IPython .html import widgets
8
7
from IPython .utils .traitlets import Unicode
9
8
from IPython .display import Javascript , display
10
9
11
- from plotly import utils
10
+ from plotly import utils , tools
12
11
from pkg_resources import resource_string
13
12
14
13
# Load JS widget code
@@ -247,6 +246,18 @@ def message_handler(widget, ranges):
247
246
"""
248
247
self ._handle_registration ('zoom' , callback , remove )
249
248
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
+
250
261
def restyle (self , data , indices = None ):
251
262
"""Update the style of existing traces in the Plotly graph.
252
263
You can’t perform that action at this time.
0 commit comments