Skip to content

Commit 7af6dd0

Browse files
committedJul 3, 2018
Merge branch 'ipyplotly_integration' of https://github.com/plotly/plotly.py into ipyplotly_integration
2 parents 0e47d11 + 651b215 commit 7af6dd0

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed
 

‎CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
2020
### Changed
2121
- Improved data validation covering the full API with clear, informative error messages. This means that incorrect properties and/or values now always raise a `ValueError` with a description of the error, the invalid property, and the available properties on the level that it was placed in the graph object. Eg. `go.Scatter(foo=123)` raises a validation error. See https://plot.ly/python/reference/ for a reference to all valid properties and values in the Python API.
2222

23-
- Graph objs are no longer dicts, though they still provide many dict-like magic methods. Running a cell of a graph object now prints a dict-style representation of the object:
23+
- Graph objects are no longer dicts, though they still provide many dict-like magic methods. Running a cell of a graph object now prints a dict-style representation of the object:
2424

2525
Eg. `plotly.graph_objs.Scatter()` prints
2626

‎migration-guide.md

+28-6
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,37 @@ f.add_scatter(x=[1,2,3], y=[4,3,2])
2727
f
2828
```
2929

30-
## New __repr__ method
31-
plotly figures and graph objects now include the dict-like `__repr__` method that represents the object as a string
30+
## New Plotly Object Representation
31+
Plotly figures and graph objects have an updated `__repr__` method that displays objects in a pretty printed form that can be copied, pasted, and evaluated to recreate the object.
32+
33+
Eg. `print(f)` returns
34+
35+
```
36+
FigureWidget({
37+
'data': [{'type': 'scatter', 'uid': '07968b11-7b0a-11e8-ba67-c869cda04ed6', 'x': [1, 2, 3], 'y': [4, 3, 2]}],
38+
'layout': {}
39+
})
40+
```
41+
42+
## New Figure.data Assignment
43+
- Assignment to the `Figure.data` property must contain a permutation of a subset of the existing traces. Assignment can be used to reorder and remove traces, but cannot currently add new traces.
44+
45+
Suppose a figure, fig, has 3 traces. The following command is valid and it will move the third trace to be the first, the first trace to be the second, and it will remove the second trace.
3246

3347
```
34-
f.__repr__()
48+
fig.data = [fig.data[2], fig.data[0]]
3549
```
3650

51+
However this is not valid:
52+
```
53+
fig.data = [fig.data[0], go.Scatter(y=[2, 3, 1])]
54+
```
55+
56+
It's not valid because it's introducing a new trace during assignment. This trace would need to be added using `add_trace` instead.
57+
58+
3759
## 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.
60+
Let's create a subplot then turn it into a FigureWidget to display in the notebook. Note that `append_trace` is now deprecated. Use `add_trace` or `add_traces` instead.
3961

4062
```
4163
import plotly
@@ -56,7 +78,7 @@ f2.layout.title = 'Age against variables relating to diabetes'
5678
f2
5779
```
5880

59-
## What doesn't work anymore
81+
## Breaking Changes
6082
Run the following examples to see what is now deprecated or not valid:
6183

6284
- Data array properties may not be specified as scalars:
@@ -65,7 +87,7 @@ import plotly.graph_objs as go
6587
go.Bar(x=1)
6688
```
6789

68-
- Undocumented properties are no longer available. These include: `.to_string`, `.strip_style`, `.get_data`, `.validate` and `.to_dataframe`.
90+
- Several undocumented `Figure` methods have been removed. These include: `.to_string`, `.strip_style`, `.get_data`, `.validate` and `.to_dataframe`.
6991

7092
- 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:
7193

‎plotly/tests/test_core/test_file/test_file.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class FolderAPITestCase(PlotlyTestCase):
2020

2121
def setUp(self):
2222
super(FolderAPITestCase, self).setUp()
23-
py.sign_in('PythonTest', '9v9f20pext')
23+
py.sign_in('PythonTest', 'xnyU0DEwvAQQCwHVseIL')
2424

2525
def _random_filename(self):
2626
choice_chars = string.ascii_letters + string.digits

‎plotly/tests/test_core/test_grid/test_grid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class GridTest(PlotlyTestCase):
3838

3939
def setUp(self):
4040
super(GridTest, self).setUp()
41-
py.sign_in('PythonTest', '9v9f20pext')
41+
py.sign_in('PythonTest', 'xnyU0DEwvAQQCwHVseIL')
4242

4343
def get_grid(self):
4444
c1 = Column([1, 2, 3, 4], 'first column')

‎plotly/tests/test_core/test_meta/test_meta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MetaTest(PlotlyTestCase):
2626

2727
def setUp(self):
2828
super(MetaTest, self).setUp()
29-
py.sign_in('PythonTest', '9v9f20pext')
29+
py.sign_in('PythonTest', 'xnyU0DEwvAQQCwHVseIL')
3030

3131
def random_filename(self):
3232
random_chars = [random.choice(string.ascii_uppercase) for _ in range(5)]

0 commit comments

Comments
 (0)
Please sign in to comment.