@@ -458,8 +458,9 @@ def update(self, dict1=None, overwrite=False, **kwargs):
458458 --------
459459 >>> import plotly.graph_objs as go
460460 >>> fig = go.Figure(data=[{'y': [1, 2, 3]}])
461- >>> fig.update(data=[{'y': [4, 5, 6]}])
462- >>> fig.to_plotly_json()
461+ >>> fig.update(data=[{'y': [4, 5, 6]}]) # doctest: +ELLIPSIS
462+ Figure(...)
463+ >>> fig.to_plotly_json() # doctest: +SKIP
463464 {'data': [{'type': 'scatter',
464465 'uid': 'e86a7c7a-346a-11e8-8aa8-a0999b0c017b',
465466 'y': array([4, 5, 6], dtype=int32)}],
@@ -468,8 +469,9 @@ def update(self, dict1=None, overwrite=False, **kwargs):
468469 >>> fig = go.Figure(layout={'xaxis':
469470 ... {'color': 'green',
470471 ... 'range': [0, 1]}})
471- >>> fig.update({'layout': {'xaxis': {'color': 'pink'}}})
472- >>> fig.to_plotly_json()
472+ >>> fig.update({'layout': {'xaxis': {'color': 'pink'}}}) # doctest: +ELLIPSIS
473+ Figure(...)
474+ >>> fig.to_plotly_json() # doctest: +SKIP
473475 {'data': [],
474476 'layout': {'xaxis':
475477 {'color': 'pink',
@@ -1128,6 +1130,8 @@ def plotly_restyle(self, restyle_data, trace_indexes=None, **kwargs):
11281130 example, the following command would be used to update the 'x'
11291131 property of the first trace to the list [1, 2, 3]
11301132
1133+ >>> import plotly.graph_objects as go
1134+ >>> fig = go.Figure(go.Scatter(x=[2, 4, 6]))
11311135 >>> fig.plotly_restyle({'x': [[1, 2, 3]]}, 0)
11321136
11331137 trace_indexes : int or list of int
@@ -1586,15 +1590,19 @@ def add_trace(self, trace, row=None, col=None, secondary_y=None):
15861590 Add two Scatter traces to a figure
15871591
15881592 >>> fig = go.Figure()
1589- >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]))
1590- >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]))
1593+ >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2])) # doctest: +ELLIPSIS
1594+ Figure(...)
1595+ >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2])) # doctest: +ELLIPSIS
1596+ Figure(...)
15911597
15921598
15931599 Add two Scatter traces to vertically stacked subplots
15941600
15951601 >>> fig = subplots.make_subplots(rows=2)
1596- >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]), row=1, col=1)
1597- >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]), row=2, col=1)
1602+ >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]), row=1, col=1) # doctest: +ELLIPSIS
1603+ Figure(...)
1604+ >>> fig.add_trace(go.Scatter(x=[1,2,3], y=[2,1,2]), row=2, col=1) # doctest: +ELLIPSIS
1605+ Figure(...)
15981606 """
15991607 # Make sure we have both row and col or neither
16001608 if row is not None and col is None :
@@ -1662,14 +1670,16 @@ def add_traces(self, data, rows=None, cols=None, secondary_ys=None):
16621670
16631671 >>> fig = go.Figure()
16641672 >>> fig.add_traces([go.Scatter(x=[1,2,3], y=[2,1,2]),
1665- ... go.Scatter(x=[1,2,3], y=[2,1,2])])
1673+ ... go.Scatter(x=[1,2,3], y=[2,1,2])]) # doctest: +ELLIPSIS
1674+ Figure(...)
16661675
16671676 Add two Scatter traces to vertically stacked subplots
16681677
16691678 >>> fig = subplots.make_subplots(rows=2)
16701679 >>> fig.add_traces([go.Scatter(x=[1,2,3], y=[2,1,2]),
16711680 ... go.Scatter(x=[1,2,3], y=[2,1,2])],
1672- ... rows=[1, 2], cols=[1, 1])
1681+ ... rows=[1, 2], cols=[1, 1]) # doctest: +ELLIPSIS
1682+ Figure(...)
16731683 """
16741684
16751685 # Validate traces
@@ -2152,11 +2162,12 @@ def _build_dispatch_plan(key_path_strs):
21522162
21532163 Examples
21542164 --------
2165+
21552166 >>> key_path_strs = ['xaxis.rangeselector.font.color',
21562167 ... 'xaxis.rangeselector.bgcolor']
21572168
2158- >>> BaseFigure._build_dispatch_plan(key_path_strs)
2159- {(): {( 'xaxis',) ,
2169+ >>> BaseFigure._build_dispatch_plan(key_path_strs) # doctest: +SKIP
2170+ {(): {'xaxis',
21602171 ('xaxis', 'rangeselector'),
21612172 ('xaxis', 'rangeselector', 'bgcolor'),
21622173 ('xaxis', 'rangeselector', 'font'),
@@ -2589,7 +2600,7 @@ def batch_animate(self, duration=500, easing="cubic-in-out"):
25892600 2) Animate a change in the size and color of the trace's markers
25902601 over 2 seconds using the elastic-in-out easing method
25912602
2592- >>> with fig.batch_update (duration=2000, easing='elastic-in-out'):
2603+ >>> with fig.batch_animate (duration=2000, easing='elastic-in-out'):
25932604 ... fig.data[0].marker.color = 'green'
25942605 ... fig.data[0].marker.size = 20
25952606 """
@@ -4088,6 +4099,8 @@ def on_change(self, callback, *args, **kwargs):
40884099 Register callback that prints out the range extents of the xaxis and
40894100 yaxis whenever either either of them changes.
40904101
4102+ >>> import plotly.graph_objects as go
4103+ >>> fig = go.Figure(go.Scatter(x=[1, 2], y=[1, 0]))
40914104 >>> fig.layout.on_change(
40924105 ... lambda obj, xrange, yrange: print("%s-%s" % (xrange, yrange)),
40934106 ... ('xaxis', 'range'), ('yaxis', 'range'))
@@ -4572,13 +4585,15 @@ def on_hover(self, callback, append=False):
45724585 Examples
45734586 --------
45744587
4588+ >>> import plotly.graph_objects as go
45754589 >>> from plotly.callbacks import Points, InputDeviceState
45764590 >>> points, state = Points(), InputDeviceState()
45774591
45784592 >>> def hover_fn(trace, points, state):
45794593 ... inds = points.point_inds
45804594 ... # Do something
45814595
4596+ >>> trace = go.Scatter(x=[1, 2], y=[3, 0])
45824597 >>> trace.on_hover(hover_fn)
45834598
45844599 Note: The creation of the `points` and `state` objects is optional,
@@ -4632,13 +4647,15 @@ def on_unhover(self, callback, append=False):
46324647 Examples
46334648 --------
46344649
4650+ >>> import plotly.graph_objects as go
46354651 >>> from plotly.callbacks import Points, InputDeviceState
46364652 >>> points, state = Points(), InputDeviceState()
46374653
46384654 >>> def unhover_fn(trace, points, state):
46394655 ... inds = points.point_inds
46404656 ... # Do something
46414657
4658+ >>> trace = go.Scatter(x=[1, 2], y=[3, 0])
46424659 >>> trace.on_unhover(unhover_fn)
46434660
46444661 Note: The creation of the `points` and `state` objects is optional,
@@ -4692,13 +4709,15 @@ def on_click(self, callback, append=False):
46924709 Examples
46934710 --------
46944711
4712+ >>> import plotly.graph_objects as go
46954713 >>> from plotly.callbacks import Points, InputDeviceState
46964714 >>> points, state = Points(), InputDeviceState()
46974715
46984716 >>> def click_fn(trace, points, state):
46994717 ... inds = points.point_inds
47004718 ... # Do something
47014719
4720+ >>> trace = go.Scatter(x=[1, 2], y=[3, 0])
47024721 >>> trace.on_click(click_fn)
47034722
47044723 Note: The creation of the `points` and `state` objects is optional,
@@ -4751,13 +4770,15 @@ def on_selection(self, callback, append=False):
47514770 Examples
47524771 --------
47534772
4773+ >>> import plotly.graph_objects as go
47544774 >>> from plotly.callbacks import Points
47554775 >>> points = Points()
47564776
47574777 >>> def selection_fn(trace, points, selector):
47584778 ... inds = points.point_inds
47594779 ... # Do something
47604780
4781+ >>> trace = go.Scatter(x=[1, 2], y=[3, 0])
47614782 >>> trace.on_selection(selection_fn)
47624783
47634784 Note: The creation of the `points` object is optional,
@@ -4817,13 +4838,15 @@ def on_deselect(self, callback, append=False):
48174838 Examples
48184839 --------
48194840
4841+ >>> import plotly.graph_objects as go
48204842 >>> from plotly.callbacks import Points
48214843 >>> points = Points()
48224844
48234845 >>> def deselect_fn(trace, points):
48244846 ... inds = points.point_inds
48254847 ... # Do something
48264848
4849+ >>> trace = go.Scatter(x=[1, 2], y=[3, 0])
48274850 >>> trace.on_deselect(deselect_fn)
48284851
48294852 Note: The creation of the `points` object is optional,
0 commit comments