@@ -248,7 +248,46 @@ def message_handler(widget, ranges):
248
248
self ._handle_registration ('zoom' , callback , remove )
249
249
250
250
def plot (self , figure_or_data , validate = True ):
251
- """Plot figure_or_data in the Plotly graph.
251
+ """Plot figure_or_data in the Plotly graph widget.
252
+
253
+ Args:
254
+ figure_or_data (dict, list, or plotly.graph_obj object):
255
+ The standard Plotly graph object that describes Plotly
256
+ graphs as used in `plotly.plotly.plot`. See examples
257
+ of the figure_or_data in https://plot.ly/python/
258
+
259
+ Returns: None
260
+
261
+ Example 1 - Graph a scatter plot:
262
+ ```
263
+ from plotly.graph_objs import Scatter
264
+ g = GraphWidget()
265
+ g.plot([Scatter(x=[1, 2, 3], y=[10, 15, 13])])
266
+ ```
267
+
268
+ Example 2 - Graph a scatter plot with a title:
269
+ ```
270
+ from plotly.graph_objs import Scatter, Figure, Data
271
+ fig = Figure(
272
+ data = Data([
273
+ Scatter(x=[1, 2, 3], y=[20, 15, 13])
274
+ ]),
275
+ layout = Layout(title='Experimental Data')
276
+ )
277
+
278
+ g = GraphWidget()
279
+ g.plot(fig)
280
+ ```
281
+
282
+ Example 3 - Clear a graph widget
283
+ ```
284
+ from plotly.graph_objs import Scatter, Figure
285
+ g = GraphWidget()
286
+ g.plot([Scatter(x=[1, 2, 3], y=[10, 15, 13])])
287
+
288
+ # Now clear it
289
+ g.plot({}) # alternatively, g.plot(Figure())
290
+ ```
252
291
"""
253
292
if figure_or_data == {} or figure_or_data == Figure ():
254
293
validate = False
0 commit comments