Skip to content

Commit 959e24f

Browse files
committed
fixed up migration-guide
1 parent 069ed58 commit 959e24f

File tree

1 file changed

+50
-8
lines changed

1 file changed

+50
-8
lines changed

migration-guide.md

+50-8
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,65 @@ import plotly
1010
import plotly.graph_objs as go
1111
1212
f = go.FigureWidget()
13-
f.add_scatter(x=[1, 2, 3], y=[4, 3, 5])
13+
```
14+
15+
## Tab Completion
16+
Entering ``f.add_<tab>`` displays add methods for all of the supported trace types. Try it!
17+
```
18+
f.add_
19+
```
20+
21+
Entering `f.add_scatter(<tab>)` displays the names of all of the top-level properties for the scatter trace type
22+
23+
Entering `f.add_scatter(<shift+tab>)` displays the signature pop-up. Expanding this pop-up reveals the method doc string which contains the descriptions of all of the top level properties. Let's finish add a scatter trace to `f`:
24+
25+
```
26+
f.add_scatter(x=[1,2,3], y=[4,3,2])
1427
f
1528
```
1629

17-
##
30+
## New __repr__ method
31+
plotly figures and graph objects now include the dict-like `__repr__` method that represents the object as a string
32+
33+
```
34+
f.__repr__()
35+
```
1836

37+
## FigureWidget Subplot Example
38+
Let's create a subplot then turn it into a FigureWidget to display in the notebook. Note that `append_trace` is no deprecated. Use `add_trace` or `add_traces` instead.
1939

20-
#### Tab completion
21-
Entering ``f1.add_<tab>`` displays add methods for all of the supported trace types
2240
```
23-
# f1.add_
41+
import plotly
42+
import plotly.graph_objs as go
43+
import plotly.tools as tls
44+
45+
import pandas as pd
46+
dataset = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/diabetes.csv')
47+
48+
subplot = tls.make_subplots(2, 2, print_grid=False)
49+
f2 = go.FigureWidget(subplot)
50+
51+
f2.add_trace(go.Scatter(x=dataset['Age'], y=dataset['Pregnancies'], mode='markers'), 1,1)
52+
f2.add_trace(go.Scatter(x=dataset['Age'], y=dataset['BMI'], mode='markers'), 1,2)
53+
f2.add_trace(go.Scatter(x=dataset['Age'], y=dataset['SkinThickness'], mode='markers'), 2,1)
54+
f2.add_trace(go.Scatter(x=dataset['Age'], y=dataset['BloodPressure'], mode='markers'), 2,2)
55+
f2.layout.title = 'Age against variables relating to diabetes'
56+
f2
57+
```
58+
59+
## What doesn't work anymore
60+
Run the following examples to see what is now deprecated or not valid:
61+
62+
- Data array properties may not be specified as scalars:
63+
```
64+
import plotly.graph_objs as go
65+
go.Bar(x=1)
2466
```
2567

26-
Entering ``f1.add_scatter(<tab>)`` displays the names of all of the top-level properties for the scatter trace type
68+
- Undocumented properties are no longer available. These include: `.to_string`, `.strip_style`, `.get_data`, `.validate` and `.to_dataframe`.
2769

28-
Entering ``f1.add_scatter(<shift+tab>)`` displays the signature pop-up. Expanding this pop-up reveals the method doc string which contains the descriptions of all of the top level properties
70+
- Object arrays such as `Figure.data` and `Layout.images` are now represented as tuples of graph objects, not lists. Run the following as a sanity check:
2971

3072
```
31-
# f1.add_scatter(
73+
type(go.Figure().data)
3274
```

0 commit comments

Comments
 (0)