Skip to content

Commit e0301ad

Browse files
committed
add example in Figure.append_trace docstring on ref in make_subplots
1 parent 1f1960d commit e0301ad

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

plotly/graph_objs/graph_objs.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,17 @@ def append_trace(self, trace, row, col):
941941
The row, col index is generated from figures created with
942942
plotly.tools.make_subplots and can be viewed with Figure.print_grid.
943943
944+
Example:
945+
# stack two subplots vertically
946+
fig = tools.make_subplots(rows=2)
947+
948+
This is the format of your plot grid:
949+
[ (1,1) x1,y1 ]
950+
[ (2,1) x2,y2 ]
951+
952+
fig.append_trace(Scatter(x=[1,2,3], y=[2,1,2]), 1, 1)
953+
fig.append_trace(Scatter(x=[1,2,3], y=[2,1,2]), 2, 1)
954+
944955
Arguments:
945956
946957
trace (plotly trace object):

plotly/tools.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,8 @@ def make_subplots(rows=1, cols=1,
511511
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2])]
512512
fig['data'] += [Scatter(x=[1,2,3], y=[2,1,2], xaxis='x2', yaxis='y2')]
513513
514+
# or see Figure.append_trace
515+
514516
Example 2:
515517
# subplots with shared x axes
516518
fig = tools.make_subplots(rows=2, shared_xaxes=True)

0 commit comments

Comments
 (0)