Add traces to the figure Parameters ---------- data : list[BaseTraceType or dict] A list of trace specifications to be added. Trace specifications may be either: - Instances of trace classes from the plotly.graph_objs
(
self,
data,
rows=None,
cols=None,
secondary_ys=None,
exclude_empty_subplots=False,
)
| 2129 | ) |
| 2130 | |
| 2131 | def add_traces( |
| 2132 | self, |
| 2133 | data, |
| 2134 | rows=None, |
| 2135 | cols=None, |
| 2136 | secondary_ys=None, |
| 2137 | exclude_empty_subplots=False, |
| 2138 | ): |
| 2139 | """ |
| 2140 | Add traces to the figure |
| 2141 | |
| 2142 | Parameters |
| 2143 | ---------- |
| 2144 | data : list[BaseTraceType or dict] |
| 2145 | A list of trace specifications to be added. |
| 2146 | Trace specifications may be either: |
| 2147 | |
| 2148 | - Instances of trace classes from the plotly.graph_objs |
| 2149 | package (e.g plotly.graph_objs.Scatter, plotly.graph_objs.Bar) |
| 2150 | - Dicts where: |
| 2151 | |
| 2152 | - The 'type' property specifies the trace type (e.g. |
| 2153 | 'scatter', 'bar', 'area', etc.). If the dict has no 'type' |
| 2154 | property then 'scatter' is assumed. |
| 2155 | - All remaining properties are passed to the constructor |
| 2156 | of the specified trace type. |
| 2157 | |
| 2158 | rows : None, list[int], or int (default None) |
| 2159 | List of subplot row indexes (starting from 1) for the traces to be |
| 2160 | added. Only valid if figure was created using |
| 2161 | `plotly.tools.make_subplots` |
| 2162 | If a single integer is passed, all traces will be added to row number |
| 2163 | |
| 2164 | cols : None or list[int] (default None) |
| 2165 | List of subplot column indexes (starting from 1) for the traces |
| 2166 | to be added. Only valid if figure was created using |
| 2167 | `plotly.tools.make_subplots` |
| 2168 | If a single integer is passed, all traces will be added to column number |
| 2169 | |
| 2170 | |
| 2171 | secondary_ys: None or list[boolean] (default None) |
| 2172 | List of secondary_y booleans for traces to be added. See the |
| 2173 | docstring for `add_trace` for more info. |
| 2174 | |
| 2175 | exclude_empty_subplots: boolean |
| 2176 | If True, the trace will not be added to subplots that don't already |
| 2177 | have traces. |
| 2178 | |
| 2179 | Returns |
| 2180 | ------- |
| 2181 | BaseFigure |
| 2182 | The Figure that add_traces was called on |
| 2183 | |
| 2184 | Examples |
| 2185 | -------- |
| 2186 | |
| 2187 | >>> from plotly import subplots |
| 2188 | >>> import plotly.graph_objs as go |