Skip to content

Commit cbed6b9

Browse files
committed
migration guide and editted notebook examples
1 parent 83dbc43 commit cbed6b9

File tree

6 files changed

+209
-91
lines changed

6 files changed

+209
-91
lines changed

migration-guide.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
# Migration to Plotly 3.0.0
22

3-
Plotly 3 introduces enhancements to the plotly.py visualization library and demonstrates some of its features.
3+
Plotly 3 introduces enhancements to the `plotly.py` visualization library and demonstrates some of its features.
44

55

66
# What have we Added?
77
- Traces can be added and updated interactively by simply assigning to properties
8+
89
- The full Traces and Layout API is generated from the plotly schema to provide a great experience for interactive use in the notebook
10+
911
- Data validation covering the full API with clear, informative error messages
12+
13+
14+
1015
- Jupyter friendly docstrings on constructor params and properties
16+
1117
- Support for setting array properties as numpy arrays. When numpy arrays are used, ipywidgets binary serialization protocol is used to avoid converting these to JSON strings.
18+
1219
- Context manager API for animation
13-
- Programmatic export of figures to static SVG images (and PNG and PDF with cairosvg installed).
1420

21+
- Programmatic export of figures to static SVG images (and PNG and PDF with cairosvg installed).
1522

1623

1724
```

specs/ipyplotly_integration/Compatibility Notes.ipynb

+49-46
Large diffs are not rendered by default.

specs/ipyplotly_integration/DataShaderExample.ipynb

+36-22
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,19 @@
3333
"cell_type": "code",
3434
"execution_count": 1,
3535
"metadata": {},
36-
"outputs": [],
36+
"outputs": [
37+
{
38+
"ename": "ImportError",
39+
"evalue": "No module named datashader",
40+
"output_type": "error",
41+
"traceback": [
42+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
43+
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
44+
"\u001b[0;32m<ipython-input-1-7429c7dd0e8a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;31m# datashader\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 19\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mdatashader\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 20\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mdatashader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtransfer_functions\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 21\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mdatashader\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolors\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0minferno\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
45+
"\u001b[0;31mImportError\u001b[0m: No module named datashader"
46+
]
47+
}
48+
],
3749
"source": [
3850
"# ipyplotly\n",
3951
"from plotly.graph_objs import FigureWidget\n",
@@ -209,7 +221,9 @@
209221
{
210222
"cell_type": "code",
211223
"execution_count": 3,
212-
"metadata": {},
224+
"metadata": {
225+
"collapsed": true
226+
},
213227
"outputs": [],
214228
"source": [
215229
"def gen_ds_image(x_range, y_range, plot_width, plot_height):\n",
@@ -238,7 +252,9 @@
238252
{
239253
"cell_type": "code",
240254
"execution_count": 4,
241-
"metadata": {},
255+
"metadata": {
256+
"collapsed": true
257+
},
242258
"outputs": [],
243259
"source": [
244260
"x_range=[3, 10]\n",
@@ -250,7 +266,9 @@
250266
{
251267
"cell_type": "code",
252268
"execution_count": 5,
253-
"metadata": {},
269+
"metadata": {
270+
"collapsed": true
271+
},
254272
"outputs": [],
255273
"source": [
256274
"# Test image generation function and display the PIL image\n",
@@ -334,7 +352,9 @@
334352
{
335353
"cell_type": "code",
336354
"execution_count": 8,
337-
"metadata": {},
355+
"metadata": {
356+
"collapsed": true
357+
},
338358
"outputs": [],
339359
"source": [
340360
"# Set background image\n",
@@ -360,7 +380,9 @@
360380
{
361381
"cell_type": "code",
362382
"execution_count": 9,
363-
"metadata": {},
383+
"metadata": {
384+
"collapsed": true
385+
},
364386
"outputs": [],
365387
"source": [
366388
"def update_ds_image(layout, x_range, y_range, plot_width, plot_height):\n",
@@ -439,7 +461,9 @@
439461
{
440462
"cell_type": "code",
441463
"execution_count": 11,
442-
"metadata": {},
464+
"metadata": {
465+
"collapsed": true
466+
},
443467
"outputs": [],
444468
"source": [
445469
"f.layout.xaxis.range = [3.5, 9]"
@@ -494,7 +518,9 @@
494518
{
495519
"cell_type": "code",
496520
"execution_count": 20,
497-
"metadata": {},
521+
"metadata": {
522+
"collapsed": true
523+
},
498524
"outputs": [],
499525
"source": [
500526
"with f.batch_update():\n",
@@ -505,21 +531,9 @@
505531
],
506532
"metadata": {
507533
"kernelspec": {
508-
"display_name": "Python [default]",
534+
"display_name": "Python 2",
509535
"language": "python",
510-
"name": "python3"
511-
},
512-
"language_info": {
513-
"codemirror_mode": {
514-
"name": "ipython",
515-
"version": 3
516-
},
517-
"file_extension": ".py",
518-
"mimetype": "text/x-python",
519-
"name": "python",
520-
"nbconvert_exporter": "python",
521-
"pygments_lexer": "ipython3",
522-
"version": "3.6.4"
536+
"name": "python2"
523537
}
524538
},
525539
"nbformat": 4,

specs/ipyplotly_integration/Overview.ipynb

+15-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@
2929
},
3030
{
3131
"cell_type": "code",
32-
"execution_count": 1,
33-
"metadata": {
34-
"collapsed": true
35-
},
36-
"outputs": [],
32+
"execution_count": 2,
33+
"metadata": {},
34+
"outputs": [
35+
{
36+
"ename": "ImportError",
37+
"evalue": "cannot import name InputState",
38+
"output_type": "error",
39+
"traceback": [
40+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
41+
"\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)",
42+
"\u001b[0;32m<ipython-input-2-316fcd291462>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# ipyplotly\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mplotly\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph_objs\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mFigureWidget\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mplotly\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcallbacks\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPoints\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mInputState\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;31m# pandas\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
43+
"\u001b[0;31mImportError\u001b[0m: cannot import name InputState"
44+
]
45+
}
46+
],
3747
"source": [
3848
"# ipyplotly\n",
3949
"from plotly.graph_objs import FigureWidget\n",

0 commit comments

Comments
 (0)