|
9 | 9 | "<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online).\n",
|
10 | 10 | "<br>We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!\n",
|
11 | 11 | "#### Version Check\n",
|
12 |
| - "Plotly's python package is updated frequently. Run `pip install plotly --upgrade` to use the latest version. " |
13 |
| - ] |
14 |
| - }, |
15 |
| - { |
16 |
| - "cell_type": "code", |
17 |
| - "execution_count": 1, |
18 |
| - "metadata": {}, |
19 |
| - "outputs": [ |
20 |
| - { |
21 |
| - "data": { |
22 |
| - "text/plain": [ |
23 |
| - "'3.1.1'" |
24 |
| - ] |
25 |
| - }, |
26 |
| - "execution_count": 1, |
27 |
| - "metadata": {}, |
28 |
| - "output_type": "execute_result" |
29 |
| - } |
30 |
| - ], |
31 |
| - "source": [ |
32 |
| - "import plotly\n", |
33 |
| - "plotly.__version__" |
| 12 | + "This is documentation for version 2 of plotly.py. See the [changelog](https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md#270---2018-05-23) for differences between package versions." |
34 | 13 | ]
|
35 | 14 | },
|
36 | 15 | {
|
37 | 16 | "cell_type": "markdown",
|
38 |
| - "metadata": {}, |
| 17 | + "metadata": { |
| 18 | + "collapsed": true |
| 19 | + }, |
39 | 20 | "source": [
|
40 | 21 | "#### Basic Overlaid Area Chart"
|
41 | 22 | ]
|
|
48 | 29 | {
|
49 | 30 | "data": {
|
50 | 31 | "text/html": [
|
51 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/429.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 32 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2887.embed\" height=\"525px\" width=\"100%\"></iframe>" |
52 | 33 | ],
|
53 | 34 | "text/plain": [
|
54 | 35 | "<plotly.tools.PlotlyDisplay object>"
|
|
75 | 56 | ")\n",
|
76 | 57 | "\n",
|
77 | 58 | "data = [trace1, trace2]\n",
|
78 |
| - "py.iplot(data, filename='basic-area')" |
| 59 | + "py.iplot(data, filename='basic-area-v2')" |
79 | 60 | ]
|
80 | 61 | },
|
81 | 62 | {
|
82 | 63 | "cell_type": "markdown",
|
83 |
| - "metadata": {}, |
| 64 | + "metadata": { |
| 65 | + "collapsed": true |
| 66 | + }, |
84 | 67 | "source": [
|
85 | 68 | "#### Overlaid Area Chart Without Boundary Lines"
|
86 | 69 | ]
|
|
93 | 76 | {
|
94 | 77 | "data": {
|
95 | 78 | "text/html": [
|
96 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/431.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 79 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2889.embed\" height=\"525px\" width=\"100%\"></iframe>" |
97 | 80 | ],
|
98 | 81 | "text/plain": [
|
99 | 82 | "<plotly.tools.PlotlyDisplay object>"
|
|
122 | 105 | ")\n",
|
123 | 106 | "\n",
|
124 | 107 | "data = [trace1, trace2]\n",
|
125 |
| - "py.iplot(data, filename='basic-area-no-bound')" |
| 108 | + "py.iplot(data, filename='basic-area-no-bound-v2')" |
126 | 109 | ]
|
127 | 110 | },
|
128 | 111 | {
|
129 | 112 | "cell_type": "markdown",
|
130 |
| - "metadata": {}, |
| 113 | + "metadata": { |
| 114 | + "collapsed": true |
| 115 | + }, |
131 | 116 | "source": [
|
132 | 117 | "#### Interior Filling for Area Chart"
|
133 | 118 | ]
|
|
140 | 125 | {
|
141 | 126 | "data": {
|
142 | 127 | "text/html": [
|
143 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/433.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 128 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2891.embed\" height=\"525px\" width=\"100%\"></iframe>" |
144 | 129 | ],
|
145 | 130 | "text/plain": [
|
146 | 131 | "<plotly.tools.PlotlyDisplay object>"
|
|
175 | 160 | ")\n",
|
176 | 161 | "\n",
|
177 | 162 | "data = [trace0, trace1]\n",
|
178 |
| - "py.iplot(data, filename='filling-interior-area')" |
| 163 | + "py.iplot(data, filename='filling-interior-area-v2')" |
179 | 164 | ]
|
180 | 165 | },
|
181 | 166 | {
|
182 | 167 | "cell_type": "markdown",
|
183 |
| - "metadata": {}, |
| 168 | + "metadata": { |
| 169 | + "collapsed": true |
| 170 | + }, |
184 | 171 | "source": [
|
185 |
| - "#### Stacked Area Chart" |
| 172 | + "### Stacked Area Chart with Cumulative Values" |
186 | 173 | ]
|
187 | 174 | },
|
188 | 175 | {
|
|
193 | 180 | {
|
194 | 181 | "data": {
|
195 | 182 | "text/html": [
|
196 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/437.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 183 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2893.embed\" height=\"525px\" width=\"100%\"></iframe>" |
197 | 184 | ],
|
198 | 185 | "text/plain": [
|
199 | 186 | "<plotly.tools.PlotlyDisplay object>"
|
|
208 | 195 | "import plotly.plotly as py\n",
|
209 | 196 | "import plotly.graph_objs as go\n",
|
210 | 197 | "\n",
|
211 |
| - "# Add original data\n", |
212 |
| - "x=['Winter', 'Spring', 'Summer', 'Fall']\n", |
213 |
| - "\n", |
214 |
| - "trace0 = dict(\n", |
215 |
| - " x=x,\n", |
216 |
| - " y=[40, 60, 40, 10],\n", |
217 |
| - " hoverinfo='x+y',\n", |
| 198 | + "trace0 = go.Scatter(\n", |
| 199 | + " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
| 200 | + " y=['40', '20', '30', '40'],\n", |
218 | 201 | " mode='lines',\n",
|
219 | 202 | " line=dict(width=0.5,\n",
|
220 |
| - " color='rgb(131, 90, 241)'),\n", |
221 |
| - " stackgroup='one'\n", |
| 203 | + " color='rgb(184, 247, 212)'),\n", |
| 204 | + " fill='tonexty'\n", |
222 | 205 | ")\n",
|
223 |
| - "trace1 = dict(\n", |
224 |
| - " x=x,\n", |
225 |
| - " y=[20, 10, 10, 60],\n", |
226 |
| - " hoverinfo='x+y',\n", |
| 206 | + "trace1 = go.Scatter(\n", |
| 207 | + " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
| 208 | + " y=['50', '70', '40', '60'],\n", |
227 | 209 | " mode='lines',\n",
|
228 | 210 | " line=dict(width=0.5,\n",
|
229 | 211 | " color='rgb(111, 231, 219)'),\n",
|
230 |
| - " stackgroup='one'\n", |
| 212 | + " fill='tonexty'\n", |
231 | 213 | ")\n",
|
232 |
| - "trace2 = dict(\n", |
233 |
| - " x=x,\n", |
234 |
| - " y=[40, 30, 50, 30],\n", |
235 |
| - " hoverinfo='x+y',\n", |
| 214 | + "trace2 = go.Scatter(\n", |
| 215 | + " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
| 216 | + " y=['70', '80', '60', '70'],\n", |
236 | 217 | " mode='lines',\n",
|
237 | 218 | " line=dict(width=0.5,\n",
|
238 |
| - " color='rgb(184, 247, 212)'),\n", |
239 |
| - " stackgroup='one'\n", |
| 219 | + " color='rgb(127, 166, 238)'),\n", |
| 220 | + " fill='tonexty'\n", |
240 | 221 | ")\n",
|
241 |
| - "data = [trace0, trace1, trace2]\n", |
242 |
| - "\n", |
243 |
| - "fig = dict(data=data)\n", |
244 |
| - "py.iplot(fig, filename='stacked-area-plot-hover', validate=False)" |
| 222 | + "trace3 = go.Scatter(\n", |
| 223 | + " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
| 224 | + " y=['100', '100', '100', '100'],\n", |
| 225 | + " mode='lines',\n", |
| 226 | + " line=dict(width=0.5,\n", |
| 227 | + " color='rgb(131, 90, 241)'),\n", |
| 228 | + " fill='tonexty'\n", |
| 229 | + ")\n", |
| 230 | + "data = [trace0, trace1, trace2, trace3]\n", |
| 231 | + "layout = go.Layout(\n", |
| 232 | + " showlegend=True,\n", |
| 233 | + " xaxis=dict(\n", |
| 234 | + " type='category',\n", |
| 235 | + " ),\n", |
| 236 | + " yaxis=dict(\n", |
| 237 | + " type='linear',\n", |
| 238 | + " range=[1, 100],\n", |
| 239 | + " dtick=20,\n", |
| 240 | + " ticksuffix='%'\n", |
| 241 | + " )\n", |
| 242 | + ")\n", |
| 243 | + "fig = go.Figure(data=data, layout=layout)\n", |
| 244 | + "py.iplot(fig, filename='stacked-area-plot-v2')" |
245 | 245 | ]
|
246 | 246 | },
|
247 | 247 | {
|
248 | 248 | "cell_type": "markdown",
|
249 | 249 | "metadata": {},
|
250 | 250 | "source": [
|
251 |
| - "### Stacked Area Chart with Normalized Values" |
| 251 | + "#### Stacked Area Chart with Original Values" |
252 | 252 | ]
|
253 | 253 | },
|
254 | 254 | {
|
|
259 | 259 | {
|
260 | 260 | "data": {
|
261 | 261 | "text/html": [
|
262 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2805.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 262 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2895.embed\" height=\"525px\" width=\"100%\"></iframe>" |
263 | 263 | ],
|
264 | 264 | "text/plain": [
|
265 | 265 | "<plotly.tools.PlotlyDisplay object>"
|
|
274 | 274 | "import plotly.plotly as py\n",
|
275 | 275 | "import plotly.graph_objs as go\n",
|
276 | 276 | "\n",
|
277 |
| - "trace0 = dict(\n", |
278 |
| - " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
279 |
| - " y=['40', '20', '30', '40'],\n", |
| 277 | + "# Add original data\n", |
| 278 | + "x=['Winter', 'Spring', 'Summer', 'Fall']\n", |
| 279 | + "\n", |
| 280 | + "y0_org=[40, 60, 40, 10]\n", |
| 281 | + "y1_org=[20, 10, 10, 60]\n", |
| 282 | + "y2_org=[40, 30, 50, 30]\n", |
| 283 | + "\n", |
| 284 | + "# Add data to create cumulative stacked values\n", |
| 285 | + "y0_stck=y0_org\n", |
| 286 | + "y1_stck=[y0+y1 for y0, y1 in zip(y0_org, y1_org)]\n", |
| 287 | + "y2_stck=[y0+y1+y2 for y0, y1, y2 in zip(y0_org, y1_org, y2_org)]\n", |
| 288 | + "\n", |
| 289 | + "# Make original values strings and add % for hover text\n", |
| 290 | + "y0_txt=[str(y0)+'%' for y0 in y0_org]\n", |
| 291 | + "y1_txt=[str(y1)+'%' for y1 in y1_org]\n", |
| 292 | + "y2_txt=[str(y2)+'%' for y2 in y2_org]\n", |
| 293 | + "\n", |
| 294 | + "trace0 = go.Scatter(\n", |
| 295 | + " x=x,\n", |
| 296 | + " y=y0_stck,\n", |
| 297 | + " text=y0_txt,\n", |
| 298 | + " hoverinfo='x+text',\n", |
280 | 299 | " mode='lines',\n",
|
281 | 300 | " line=dict(width=0.5,\n",
|
282 |
| - " color='rgb(184, 247, 212)'),\n", |
283 |
| - " stackgroup='one',\n", |
284 |
| - " groupnorm='percent'\n", |
| 301 | + " color='rgb(131, 90, 241)'),\n", |
| 302 | + " fill='tonexty'\n", |
285 | 303 | ")\n",
|
286 |
| - "trace1 = dict(\n", |
287 |
| - " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
288 |
| - " y=['50', '70', '40', '60'],\n", |
| 304 | + "trace1 = go.Scatter(\n", |
| 305 | + " x=x,\n", |
| 306 | + " y=y1_stck,\n", |
| 307 | + " text=y1_txt,\n", |
| 308 | + " hoverinfo='x+text',\n", |
289 | 309 | " mode='lines',\n",
|
290 | 310 | " line=dict(width=0.5,\n",
|
291 | 311 | " color='rgb(111, 231, 219)'),\n",
|
292 |
| - " stackgroup='one'\n", |
293 |
| - ")\n", |
294 |
| - "trace2 = dict(\n", |
295 |
| - " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
296 |
| - " y=['70', '80', '60', '70'],\n", |
297 |
| - " mode='lines',\n", |
298 |
| - " line=dict(width=0.5,\n", |
299 |
| - " color='rgb(127, 166, 238)'),\n", |
300 |
| - " stackgroup='one'\n", |
| 312 | + " fill='tonexty'\n", |
301 | 313 | ")\n",
|
302 |
| - "trace3 = dict(\n", |
303 |
| - " x=['Winter', 'Spring', 'Summer', 'Fall'],\n", |
304 |
| - " y=['100', '100', '100', '100'],\n", |
| 314 | + "trace2 = go.Scatter(\n", |
| 315 | + " x=x,\n", |
| 316 | + " y=y2_stck,\n", |
| 317 | + " text=y2_txt,\n", |
| 318 | + " hoverinfo='x+text',\n", |
305 | 319 | " mode='lines',\n",
|
306 | 320 | " line=dict(width=0.5,\n",
|
307 |
| - " color='rgb(131, 90, 241)'),\n", |
308 |
| - " stackgroup='one'\n", |
309 |
| - ")\n", |
310 |
| - "data = [trace0, trace1, trace2, trace3]\n", |
311 |
| - "layout = go.Layout(\n", |
312 |
| - " showlegend=True,\n", |
313 |
| - " xaxis=dict(\n", |
314 |
| - " type='category',\n", |
315 |
| - " ),\n", |
316 |
| - " yaxis=dict(\n", |
317 |
| - " type='linear',\n", |
318 |
| - " range=[1, 100],\n", |
319 |
| - " dtick=20,\n", |
320 |
| - " ticksuffix='%'\n", |
321 |
| - " )\n", |
| 321 | + " color='rgb(184, 247, 212)'),\n", |
| 322 | + " fill='tonexty'\n", |
322 | 323 | ")\n",
|
323 |
| - "fig = dict(data=data, layout=layout)\n", |
324 |
| - "py.iplot(fig, filename='stacked-area-plot-norm', validate=False)" |
| 324 | + "data = [trace0, trace1, trace2]\n", |
| 325 | + "\n", |
| 326 | + "fig = go.Figure(data=data)\n", |
| 327 | + "py.iplot(fig, filename='stacked-area-plot-hover-v2')" |
325 | 328 | ]
|
326 | 329 | },
|
327 | 330 | {
|
|
339 | 342 | {
|
340 | 343 | "data": {
|
341 | 344 | "text/html": [
|
342 |
| - "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2502.embed\" height=\"525px\" width=\"100%\"></iframe>" |
| 345 | + "<iframe id=\"igraph\" scrolling=\"no\" style=\"border:none;\" seamless=\"seamless\" src=\"https://plot.ly/~PythonPlotBot/2897.embed\" height=\"525px\" width=\"100%\"></iframe>" |
343 | 346 | ],
|
344 | 347 | "text/plain": [
|
345 | 348 | "<plotly.tools.PlotlyDisplay object>"
|
|
393 | 396 | ")\n",
|
394 | 397 | "\n",
|
395 | 398 | "fig = go.Figure(data=data,layout=layout)\n",
|
396 |
| - "py.iplot(data, filename='select-hover-points')" |
| 399 | + "py.iplot(data, filename='select-hover-points-v2')" |
397 | 400 | ]
|
398 | 401 | },
|
399 | 402 | {
|
|
408 | 411 | },
|
409 | 412 | {
|
410 | 413 | "cell_type": "code",
|
411 |
| - "execution_count": 8, |
| 414 | + "execution_count": 1, |
412 | 415 | "metadata": {},
|
413 | 416 | "outputs": [
|
414 | 417 | {
|
|
440 | 443 | "output_type": "stream",
|
441 | 444 | "text": [
|
442 | 445 | "Collecting git+https://github.com/plotly/publisher.git\n",
|
443 |
| - " Cloning https://github.com/plotly/publisher.git to /tmp/pip-req-build-ewWF0_\n", |
| 446 | + " Cloning https://github.com/plotly/publisher.git to /tmp/pip-req-build-QQFrBt\n", |
444 | 447 | "Building wheels for collected packages: publisher\n",
|
445 | 448 | " Running setup.py bdist_wheel for publisher ... \u001b[?25ldone\n",
|
446 |
| - "\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-zaYWOc/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", |
| 449 | + "\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-Se8qIh/wheels/99/3e/a0/fbd22ba24cca72bdbaba53dbc23c1768755fb17b3af0f33966\n", |
447 | 450 | "Successfully built publisher\n",
|
448 | 451 | "Installing collected packages: publisher\n",
|
449 | 452 | " Found existing installation: publisher 0.11\n",
|
450 | 453 | " Uninstalling publisher-0.11:\n",
|
451 | 454 | " Successfully uninstalled publisher-0.11\n",
|
452 | 455 | "Successfully installed publisher-0.11\n",
|
453 |
| - "\u001b[33mYou are using pip version 10.0.1, however version 18.0 is available.\n", |
| 456 | + "\u001b[33mYou are using pip version 10.0.1, however version 18.1 is available.\n", |
454 | 457 | "You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n"
|
455 | 458 | ]
|
456 | 459 | }
|
|
504 | 507 | }
|
505 | 508 | },
|
506 | 509 | "nbformat": 4,
|
507 |
| - "nbformat_minor": 2 |
| 510 | + "nbformat_minor": 1 |
508 | 511 | }
|
0 commit comments