Skip to content

Release 3.2.0 #1157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Sep 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,74 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [3.2.0] - 2018-09-05
This release introduces the long-anticipated ability to programmatically
export figures as high quality static images in both raster and vector
formats.

### JupyterLab Versions
For use with JupyterLab, the following versions of the following packages
must be installed:

- Python Packages
- plotly==3.2.0
- ipywidgets>=7.2
- notebook>=5.3
- jupyterlab==0.34

- JupyterLab Extensions
- [email protected]
- @jupyter-widgets/[email protected]
- @jupyterlab/[email protected]

### Added
- plotly.js version 1.40.1, which introduces the following features:
- Allow `contour`, `contourcarpet` and `histogram2dcontour` to have corresponding legend items using `showlegend`
([plotly/plotly.js#2891](https://github.com/plotly/plotly.js/pull/2891),
[plotly/plotly.js#2914](https://github.com/plotly/plotly.js/pull/2914))
- Add scatterpolar and scatterpolargl attributes `r0`, `dr`, `theta0` and `dtheta`
([plotly/plotly.js#2895](https://github.com/plotly/plotly.js/pull/2895))
- Add layout attributes `piecolorway` and `extendpiecolors` for more control over pie colors
([plotly/plotly.js#2870](https://github.com/plotly/plotly.js/pull/2870))
- Add `splom` attribute `dimensions[i].axis.type` to easily override axis type in splom-generated axes
([plotly/plotly.js#2899](https://github.com/plotly/plotly.js/pull/2870))
- Add support for on-graph text in `scatterpolargl` traces
([plotly/plotly.js#2895](https://github.com/plotly/plotly.js/pull/2895))
- See [the plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#1400----2018-08-16)
for bug fixes and more information.
- Support for offline static image export with the `to_image` and `write_image`
functions in the new `plotly.io` package ([#1120](https://github.com/plotly/plotly.py/pull/1120)).
- Note: Image export requires the plotly [orca](https://github.com/plotly/orca)
command line utility and the [`psutil`](https://github.com/giampaolo/psutil) Python package.
- New documentation sections covering [Static Image Export](https://plot.ly/python/static-image-export/)
and [Orca Management](https://plot.ly/python/orca-management/)
- Support for displaying `FigureWidget` instances in static contexts
(e.g. [nbviewer](http://nbviewer.jupyter.org/)) just like the built-in ipywidgets
([#1117](https://github.com/plotly/plotly.py/pull/1117))
- Full integration of the Cividis colorscale ([#883](https://github.com/plotly/plotly.py/pull/883))
- conda packaging
- From here forward, new versions of plotly.py will be published to the [plotly anaconda channel](https://anaconda.org/plotly/)
on the same day they are published to PyPI.
([72ad0e4](https://github.com/plotly/plotly.py/commit/72ad0e4bf54bb8a06445d2ca55488ffc11c836a7))
- The [`README`](README.md) now includes conda installation instructions alongside the pip instructions.
- In addition to the existing installation approaches, orca is now also available as a
[conda package](https://anaconda.org/plotly/plotly-orca) from the plotly anaconda channel.

### Updated
- Show traces at the top of the Gantt chart's colorbar ([#1110](https://github.com/plotly/plotly.py/pull/1110))
- Significantly improved validation performance for numeric pandas `Series` objects ([#1149](https://github.com/plotly/plotly.py/pull/1149))
- Specialize auto-generated docstrings for Python syntax
- More robust and specific logic for retrying requests to the plot.ly cloud service ([#1146](https://github.com/plotly/plotly.py/pull/1146))
- Support basic authentication when using the streaming API behind a proxy server ([#1133](https://github.com/plotly/plotly.py/pull/1133))

### Fixed
- Validators for `dash` properties (e.g. `scatter.line.dash`) incorrectly rejected dash length lists ([#1136](https://github.com/plotly/plotly.py/pull/1136))
- Annotated heatmap error when custom colorscale was specified ([#1151](https://github.com/plotly/plotly.py/pull/1151))
- Incorrect deprecation warning for deprecated `plotly.graph_objs.Annotations` class ([#1138](https://github.com/plotly/plotly.py/pull/1138))
- Harmless JavaScript console error when opening an html file produced by `plotly.offline.plot` ([#1152](https://github.com/plotly/plotly.py/pull/1152))
- Incorrect validation errors when writing data to the streaming API ([#1145](https://github.com/plotly/plotly.py/pull/1145))


## [3.1.1] - 2018-08-10
This release is a minor bug-fix update to version 3.1.0

Expand Down
77 changes: 63 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

## Quickstart

`pip install plotly`
`pip install plotly "notebook>=5.3" "ipywidgets>=7.2"`

Inside [Jupyter notebook](https://jupyter.org/install):
```python
import plotly.graph_objs as go
fig = go.FigureWidget()
# Display an empty figure
fig

```
```python
# Add a scatter chart
fig.add_scatter(y=[2, 1, 4, 3])
# Add a bar chart
Expand Down Expand Up @@ -49,44 +50,92 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is

***

## Installation of plotly.py Version 3
To install plotly.py and enable Jupyter or Jupyter Lab support, run:
## Installation

plotly.py may be installed using pip...
```
pip install plotly==3.2.0
```

or conda.
```
conda install -c plotly plotly=3.2.0
```

### Jupyter Notebook Support
For use in the Jupyter Notebook, install the `notebook` and `ipywidgets`
packages using pip...

```
pip install "notebook>=5.3" "ipywidgets>=7.2"
```

of conda.

```
pip install plotly==3.1.1
pip install "notebook>=5.3" "ipywidgets>=7.2" # only necessary for Jupyter Notebook environments
conda install "notebook>=5.3" "ipywidgets>=7.2"
```

If you're using older versions of `notebook` or `ipywidgets` you may need to manually activate the widget extensions (this should not be needed for `notebook>=5.3` and `ipywidgets>=7.2`)
### JupyterLab Support
For use in JupyterLab, install the `jupyterlab` and `ipywidgets`
packages using pip...

```
jupyter nbextension enable --py widgetsnbextension --sys-prefix
jupyter nbextension enable --py plotlywidget --sys-prefix
pip install jupyterlab==0.34 "ipywidgets>=7.2"
```

In addition, to add JupyterLab support run the following commands
of conda.

```
pip install jupyterlab==0.33
conda install jupyterlab=0.34 "ipywidgets>=7.2"
```

Then run the following commands to install the required JupyterLab extensions:
```
# Avoid "JavaScript heap out of memory" errors during extension installation
# (OS X/Linux)
export NODE_OPTIONS=--max-old-space-size=4096
# (Windows)
set NODE_OPTIONS=--max-old-space-size=4096

# Jupyter widgets extension
jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.36 --no-build
jupyter labextension install @jupyter-widgets/jupyterlab-manager@0.37 --no-build

# FigureWidget support
jupyter labextension install plotlywidget@0.2.1 --no-build
jupyter labextension install plotlywidget@0.3.0 --no-build

# offline iplot support
jupyter labextension install @jupyterlab/plotly-extension@0.16 --no-build
jupyter labextension install @jupyterlab/plotly-extension@0.17 --no-build

# Build extensions (must be done to activate extensions since --no-build is used above)
jupyter lab build

# Unset NODE_OPTIONS environment variable
# (OS X/Linux)
unset NODE_OPTIONS
# (Windows)
set NODE_OPTIONS=
```

### Static Image Export
plotly.py supports static image export using the `to_image` and `write_image`
functions in the `plotly.io` package. This functionality requires the
installation of the plotly [orca](https://github.com/plotly/orca) command line utility and the
[`psutil`](https://github.com/giampaolo/psutil) Python package.

These dependencies can both be installed using conda:
```
conda install -c plotly plotly-orca psutil
```

Or, `psutil` can be installed using pip...
```
pip install psutil
```

and orca can be installed according to the instructions in the [orca README](https://github.com/plotly/orca).

## Migration
If you're migrating from plotly.py version 2, please check out the [migration guide](migration-guide.md)

## Copyright and Licenses
Expand Down
2 changes: 1 addition & 1 deletion _plotly_utils/basevalidators.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def copy_to_readonly_numpy_array(v, dtype=None, force_numeric=False):
if dtype:
new_v = np.ascontiguousarray(v.astype(dtype))
else:
new_v = np.ascontiguousarray(v)
new_v = np.ascontiguousarray(v.copy())
else:
new_v = v.copy()

Expand Down
45 changes: 41 additions & 4 deletions codegen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from importlib import import_module
from io import StringIO
from typing import List
import re

from yapf.yapflib.yapf_api import FormatCode

Expand Down Expand Up @@ -132,6 +133,42 @@ def write_init_py(pkg_root, path_parts, import_pairs):
format_and_write_source_py(init_source, filepath)


def format_description(desc):

# Remove surrounding *s from numbers
desc = re.sub('(^|[\s(,.:])\*([\d.]+)\*([\s),.:]|$)', r'\1\2\3', desc)

# replace *true* with True
desc = desc.replace("*true*", "True")
desc = desc.replace("*false*", "False")

# Replace *word* with "word"
desc = re.sub('(^|[\s(,.:])\*(\S+)\*([\s),.:]|$)', r'\1"\2"\3', desc)

# Special case strings that don't satisfy regex above
other_strings = ['Courier New', 'Droid Sans', 'Droid Serif',
'Droid Sans Mono', 'Gravitas One', 'Old Standard TT',
'Open Sans', 'PT Sans Narrow', 'Times New Roman']

for s in other_strings:
desc = desc.replace("*%s*" % s, '"%s"' % s)

# Replace {array} with list
desc = desc.replace("an {array}", "a list")
desc = desc.replace("{array}", "list")

# Replace {arrays} with lists
desc = desc.replace("{arrays}", "lists")

# replace {2D array} with 2D list
desc = desc.replace("{2D array}", "2D list")

# replace {2D arrays} with 2D lists
desc = desc.replace("{2D arrays}", "2D lists")

return desc


# Constants
# =========
# Mapping from full property paths to custom validator classes
Expand Down Expand Up @@ -412,7 +449,7 @@ def get_validator_params(self):
params['data_docs'] = (
'\"\"\"' +
self.get_constructor_params_docstring() +
'\"\"\"')
'\n\"\"\"')
else:
assert self.is_simple

Expand Down Expand Up @@ -936,7 +973,7 @@ def description(self) -> str:
if isinstance(desc, list):
desc = ''.join(desc)

return desc
return format_description(desc)


class LayoutNode(PlotlyNode):
Expand Down Expand Up @@ -986,7 +1023,7 @@ def description(self) -> str:
desc = self.node_data.get('description', '')
if isinstance(desc, list):
desc = ''.join(desc)
return desc
return format_description(desc)

# Raw data
# --------
Expand Down Expand Up @@ -1036,7 +1073,7 @@ def description(self) -> str:
desc = self.node_data.get('description', '')
if isinstance(desc, list):
desc = ''.join(desc)
return desc
return format_description(desc)

# Raw data
# --------
Expand Down
2 changes: 1 addition & 1 deletion js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotlywidget",
"version": "0.3.0-alpha.1",
"version": "0.3.0",
"description": "The plotly.py ipywidgets library",
"author": "The plotly.py team",
"license": "MIT",
Expand Down
Loading