PlotlyWidget.append_trace

PlotlyWidget.append_trace(trace, row, col)

Add a trace to the figure bound to axes at the specified row, col index.

A row, col index grid is generated for figures created with plotly.tools.make_subplots, and can be viewed with the print_grid method

Parameters
  • trace – The data trace to be bound

  • row (int) – Subplot row index (see Figure.print_grid)

  • col (int) – Subplot column index (see Figure.print_grid)

Examples

>>> from plotly import tools
>>> import plotly.graph_objs as go
>>> # stack two subplots vertically
>>> fig = tools.make_subplots(rows=2)

This is the format of your plot grid: [ (1,1) x1,y1 ] [ (2,1) x2,y2 ]

>>> fig.append_trace(go.Scatter(x=[1,2,3], y=[2,1,2]), row=1, col=1)
>>> fig.append_trace(go.Scatter(x=[1,2,3], y=[2,1,2]), row=2, col=1)