Skip to content

Sync Fork from Upstream Repo #15

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 28 commits into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
448c0a8
attempt to replace nose with pytest
emmanuelle Feb 19, 2020
39a539d
removed nose from test requirements
emmanuelle Feb 19, 2020
00ace72
replace nose with pytest
emmanuelle Feb 21, 2020
d369fcf
make black happy
emmanuelle Feb 21, 2020
0fb9958
Update packages/python/chart-studio/chart_studio/tests/test_optional/…
emmanuelle Feb 21, 2020
f2b60d8
black
emmanuelle Feb 21, 2020
dee2f7f
updated contributing notes and chart-studio tox.ini
emmanuelle Mar 2, 2020
49ffe94
using pytest parametrize
emmanuelle Mar 3, 2020
ae19bc1
fixture
emmanuelle Mar 3, 2020
5963c98
bug
emmanuelle Mar 3, 2020
1e289c4
Merge pull request #2217 from plotly/nose-to-pytest
emmanuelle Mar 3, 2020
457e2cd
Support JupyterLab 2.0.0
consideRatio Mar 4, 2020
70e5345
Bump to 1.5.3
consideRatio Mar 4, 2020
8230322
Merge pull request #2245 from consideRatio/jlab2
nicolaskruchten Mar 6, 2020
dd5df69
Update subplots.md
SylwiaOliwia2 Feb 25, 2020
4334144
Update legend.md
SylwiaOliwia2 Feb 25, 2020
8626e20
Update marker-style.md
nicolaskruchten Feb 26, 2020
4ec6ad1
Update subplots.md
SylwiaOliwia2 Feb 27, 2020
ba31e77
Update axes.md
SylwiaOliwia2 Feb 27, 2020
3f7b28d
Update facet-plots.md
SylwiaOliwia2 Feb 27, 2020
fa455fe
Update figurewidget.md
nicolaskruchten Feb 28, 2020
b1ae700
Update figurewidget-app.md
nicolaskruchten Feb 28, 2020
9747613
Update doc/python/facet-plots.md
SylwiaOliwia2 Mar 3, 2020
8831fa7
Update facet-plots.md
SylwiaOliwia2 Mar 3, 2020
fa9dd2c
Update axes.md
SylwiaOliwia2 Mar 3, 2020
024d09a
interact html export docs
nicolaskruchten Mar 3, 2020
c342af9
release 4.5.3
nicolaskruchten Mar 6, 2020
587075c
fix bad search&replace
nicolaskruchten Mar 6, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ jobs:
command: |
cd packages/python/plotly
locale
tox -e py37-core -- -a '!nodev'
tox -e py37-core -- -k 'not nodev'
no_output_timeout: 20m
- run:
name: Commit
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.5.3] - 2020-03-05

### Updated

- Removed development dependency on `nose` testing framework [#2217](https://github.com/plotly/plotly.py/pull/2217)

### Fixed

- JupyterLab extension now compatible with JupyterLab 2.0 [#2245](https://github.com/plotly/plotly.py/pull/2245) with thanks to [@consideRatio](https://github.com/consideRatio) for the contribution!

## [4.5.2] - 2020-02-24

### Fixed
Expand All @@ -11,6 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [4.5.1] - 2020-02-19

### Updated

- Updated Plotly.js to version 1.52.2. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/releases/tag/v1.52.2) for more information on bug fixes.

### Fixed
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

## Quickstart

`pip install plotly==4.5.2`
`pip install plotly==4.5.3`

Inside [Jupyter notebook](https://jupyter.org/install) (installable with `pip install "notebook>=5.3" "ipywidgets>=7.2"`):

Expand Down Expand Up @@ -75,13 +75,13 @@ Built on top of [plotly.js](https://github.com/plotly/plotly.js), `plotly.py` is
plotly.py may be installed using pip...

```
pip install plotly==4.5.2
pip install plotly==4.5.3
```

or conda.

```
conda install -c plotly plotly=4.5.2
conda install -c plotly plotly=4.5.3
```

### Jupyter Notebook Support
Expand Down Expand Up @@ -128,10 +128,10 @@ set NODE_OPTIONS=--max-old-space-size=4096
jupyter labextension install @jupyter-widgets/jupyterlab-manager@1.1 --no-build

# FigureWidget support
jupyter labextension install plotlywidget@1.5.2 --no-build
jupyter labextension install plotlywidget@1.5.3 --no-build

# and jupyterlab renderer support
jupyter labextension install jupyterlab-plotly@1.5.2 --no-build
jupyter labextension install jupyterlab-plotly@1.5.3 --no-build

# Build extensions (must be done to activate extensions since --no-build is used above)
jupyter lab build
Expand Down
30 changes: 18 additions & 12 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

The bottom line. Follow your Nose, or our Nose. Write-run-love tests :fist:.
Thank you for contributing to plotly.py!

## Code of Conduct

Expand Down Expand Up @@ -128,34 +128,40 @@ classes based on the new schema.
We take advantage of two tools to run tests:

* [`tox`](https://tox.readthedocs.io/en/latest/), which is both a virtualenv management and test tool.
* [`nose`](https://nose.readthedocs.org/en/latest/), which is is an extension of Python's unittest
* [`pytest`](https://docs.pytest.org/en/latest/), a powerful framework for unit testing.

### Running Tests with `nose`
### Running Tests with `pytest`

Since our tests cover *all* the functionality, to prevent tons of errors from showing up and having to parse through a messy output, you'll need to install `optional-requirements.txt` as explained above.

After you've done that, go ahead and follow (y)our Nose!
After you've done that, go ahead and run the test suite!

```bash
nosetests -w packages/python/plotly/plotly/tests/
pytest packages/python/plotly/plotly/tests/
```

Or for more *verbose* output:

```bash
nosetests -w packages/python/plotly/plotly/tests/ -v
pytest -v packages/python/plotly/plotly/tests/
```

Either of those will run *every* test we've written for the Python API. You can get more granular by running something like:

```bash
nosetests -w packages/python/plotly/plotly/tests/test_core/
pytest packages/python/plotly/plotly/tests/test_core/
```

... or even more granular by running something like:

```bash
nosetests plotly/tests/test_plotly/test_plot.py
pytest plotly/tests/test_plotly/test_plot.py
```

or for a specfic test function

```bash
pytest plotly/tests/test_plotly/test_plot.py::test_function
```

### Running tests with `tox`
Expand Down Expand Up @@ -187,16 +193,16 @@ Where `TOXENV` is the environment list you want to use when invoking `tox` from
* `tox` will automatically manage a virtual env for each environment you want to test in.
* You only have to run `tox` and know that the module is working in both `Python 2` and `Python 3`.

Finally, `tox` allows you to pass in additional command line arguments that are formatted in (by us) in the `tox.ini` file, see `{posargs}`. This is setup to help with our `nose attr` configuration. To run only tests that are *not* tagged with `slow`, you could use the following command:
Finally, `tox` allows you to pass in additional command line arguments that are formatted in (by us) in the `tox.ini` file, see `{posargs}`. This is setup to help with our configuration of [pytest markers](http://doc.pytest.org/en/latest/example/markers.html), which are set up in `packages/python/plotly/pytest.ini`. To run only tests that are *not* tagged with `nodev`, you could use the following command:

```bash
tox -- -a '!slow'
tox -- -a '!nodev'
```

Note that anything after `--` is substituted in for `{posargs}` in the tox.ini. For completeness, because it's reasonably confusing, if you want to force a match for *multiple* `nose attr` tags, you comma-separate the tags like so:
Note that anything after `--` is substituted in for `{posargs}` in the tox.ini. For completeness, because it's reasonably confusing, if you want to force a match for *multiple* `pytest` marker tags, you comma-separate the tags like so:

```bash
tox -- -a '!slow','!matplotlib'
tox -- -a '!nodev','!matplotlib'
```

### Writing Tests
Expand Down
21 changes: 21 additions & 0 deletions doc/python/axes.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,27 @@ fig.update_yaxes(domain=(0.25, 0.75))
fig.show()
```

#### Synchronizing axes in subplots with `matches`

Using `facet_col` from `plotly.express` let [zoom](https://help.plot.ly/zoom-pan-hover-controls/#step-3-zoom-in-and-zoom-out-autoscale-the-plot) and [pan](https://help.plot.ly/zoom-pan-hover-controls/#step-6-pan-along-axes) each facet to the same range implicitly. However, if the subplots are created with `make_subplots`, the axis needs to be updated with `matches` parameter to update all the subplots accordingly.

Zoom in one trace below, to see the other subplots zoomed to the same x-axis range. To pan all the subplots, click and drag from the center of x-axis to the side:

```python
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np

N = 20
x = np.linspace(0, 1, N)

fig = make_subplots(1, 3)
for i in range(1, 4):
fig.add_trace(go.Scatter(x=x, y=np.random.random(N)), 1, i)
fig.update_xaxes(matches='x')
fig.show()
```

#### Reference

See https://plot.ly/python/reference/#layout-xaxis and https://plot.ly/python/reference/#layout-yaxis for more information and chart attribute options!
21 changes: 21 additions & 0 deletions doc/python/facet-plots.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,24 @@ fig.show()
```python

```

### Synchronizing axes in subplots with `matches`

Using `facet_col` from `plotly.express` let [zoom](https://help.plot.ly/zoom-pan-hover-controls/#step-3-zoom-in-and-zoom-out-autoscale-the-plot) and [pan](https://help.plot.ly/zoom-pan-hover-controls/#step-6-pan-along-axes) each facet to the same range implicitly. However, if the subplots are created with `make_subplots`, the axis needs to be updated with `matches` parameter to update all the subplots accordingly.

Zoom in one trace below, to see the other subplots zoomed to the same x-axis range. To pan all the subplots, click and drag from the center of x-axis to the side:

```python
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np

N = 20
x = np.linspace(0, 1, N)

fig = make_subplots(1, 3)
for i in range(1, 4):
fig.add_trace(go.Scatter(x=x, y=np.random.random(N)), 1, i)
fig.update_xaxes(matches='x')
fig.show()
```
1 change: 1 addition & 0 deletions doc/python/figurewidget-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jupyter:
page_type: example_index
permalink: python/figurewidget-app/
thumbnail: thumbnail/multi-widget.jpg
redirect_from: /python/slider-widget/
---

#### NYC Flights Database
Expand Down
1 change: 1 addition & 0 deletions doc/python/figurewidget.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jupyter:
page_type: example_index
permalink: python/figurewidget/
thumbnail: thumbnail/figurewidget-overview.gif
redirect_from: /python/ipython-widgets/
---

#### Create a Simple FigureWidget
Expand Down
8 changes: 4 additions & 4 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ Thanks to deep integration with the [orca](https://github.com/plotly/orca) image
plotly.py may be installed using pip...

```
$ pip install plotly==4.5.2
$ pip install plotly==4.5.3
```

or conda.

```
$ conda install -c plotly plotly=4.5.2
$ conda install -c plotly plotly=4.5.3
```

This package contains everything you need to write figures to standalone HTML files.
Expand Down Expand Up @@ -144,10 +144,10 @@ set NODE_OPTIONS=--max-old-space-size=4096
jupyter labextension install @jupyter-widgets/jupyterlab-manager@1.1 --no-build

# jupyterlab renderer support
jupyter labextension install jupyterlab-plotly@1.5.2 --no-build
jupyter labextension install jupyterlab-plotly@1.5.3 --no-build

# FigureWidget support
jupyter labextension install plotlywidget@1.5.2 --no-build
jupyter labextension install plotlywidget@1.5.3 --no-build

# Build extensions (must be done to activate extensions since --no-build is used above)
jupyter lab build
Expand Down
65 changes: 65 additions & 0 deletions doc/python/interactive-html-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
jupyter:
jupytext:
notebook_metadata_filter: all
text_representation:
extension: .md
format_name: markdown
format_version: '1.2'
jupytext_version: 1.3.1
kernelspec:
display_name: Python 3
language: python
name: python3
language_info:
codemirror_mode:
name: ipython
version: 3
file_extension: .py
mimetype: text/x-python
name: python
nbconvert_exporter: python
pygments_lexer: ipython3
version: 3.6.8
plotly:
description: Plotly allows you to save interactive HTML versions of your figures
to your local disk.
display_as: file_settings
language: python
layout: base
name: Interactive HTML Export
order: 30
page_type: u-guide
permalink: python/interactive-html-export/
thumbnail: thumbnail/static-image-export.png
---

### Interactive vs Static Export

Plotly figures are interactive when viewed in a web browser: you can hover over data points, pan and zoom axes, and show and hide traces by clicking or double-clicking on the legend. You can export figures either to [static image file formats like PNG, JEPG, SVG or PDF](/python/static-image-export/) or you can export them to HTML files which can be opened in a browser. This page explains how to do the latter.

<!-- #region -->
### Saving to an HTML file

Any figure can be saved an HTML file using the `write_html` method. These HTML files can be opened in any web browser to access the fully interactive figure.

```python
import plotly.express as px

fig =px.scatter(x=range(10), y=range(10))
fig.write_html("path/to/file.html")
```
<!-- #endregion -->

### Controlling the size of the HTML file

By default, the resulting HTML file is a fully self-contained HTML file which can be uploaded to a web server or shared via email or other file-sharing mechanisms. The downside to this approach is that the file is very large (5Mb+) because it contains an inlined copy of the Plotly.js library required to make the figure interactive. This can be controlled via the `include_plotlyjs` argument (see below).


### Full Parameter Documentation

```python
import plotly.graph_objects as go

help(go.Figure.write_html)
```
25 changes: 24 additions & 1 deletion doc/python/legend.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,30 @@ fig.update_layout(
fig.show()
```

### Size of Legend Items
#### Hide the Trace Implicitly

`Graph_objects` traces have a `visible` attribute. If set to `legendonly`, the trace is hidden from the graph implicitly. Click on the name in the legend to display the hidden trace.

```python
import plotly.graph_objects as go

fig = go.Figure()

fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[1, 2, 3, 4, 5],
))

fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[5, 4, 3, 2, 1],
visible='legendonly'
))

fig.show()
```

#### Size of Legend Items

In this example [itemsizing](https://plot.ly/python/reference/#layout-legend-itemsizing) attribute determines the legend items symbols remain constant, regardless of how tiny/huge the bubbles would be in the graph.

Expand Down
Loading