Skip to content

Commit 97a2950

Browse files
authored
Merge branch 'doc-prod' into patch-1
2 parents 5985930 + dbaf309 commit 97a2950

File tree

142 files changed

+338
-412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+338
-412
lines changed

Diff for: CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [5.18.0] - 2023-10-25
6+
7+
### Updated
8+
- Updated Plotly.js from version 2.26.0 to version 2.27.0. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#2270----2023-10-20) for more information. These changes are reflected in the auto-generated `plotly.graph_objects` module. Notable changes include:
9+
- Add `insiderange` to cartesian axes to help avoid overlap between visible grid lines and tick labels of the counter axis when they are positioned inside [[#6735](https://github.com/plotly/plotly.js/pull/6735)], this feature was anonymously sponsored: thank you to our sponsor!
10+
- Fix column order changes on hover [[#6718](https://github.com/plotly/plotly.js/pull/6718)],
11+
with thanks to @bhavinpatel1109 for the contribution!
12+
- Fix hover at timestamp '1970-01-01 00:00:00' [[#6752](https://github.com/plotly/plotly.js/pull/6752)],
13+
with thanks to @adamjhawley for the contribution!
14+
- Fix clearing empty `candlestick` using react [[#6757](https://github.com/plotly/plotly.js/pull/6757)]
15+
16+
### Fixed
17+
- Repair crash on Matplotlib 3.8 related to get_offset_position [[#4372](https://github.com/plotly/plotly.py/pull/4372)],
18+
- Handle deprecation of `pandas.Series.dt.to_pydatetime()` calls and suppress the `FutureWarning` they currently emit. [[#4379](https://github.com/plotly/plotly.py/pull/4379)]
19+
520
## [5.17.0] - 2023-09-15
621

722
### Updated

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
## Quickstart
3535

36-
`pip install plotly==5.17.0`
36+
`pip install plotly==5.18.0`
3737

3838
Inside [Jupyter](https://jupyter.org/install) (installable with `pip install "jupyterlab>=3" "ipywidgets>=7.6"`):
3939

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

8080
```
81-
pip install plotly==5.17.0
81+
pip install plotly==5.18.0
8282
```
8383

8484
or conda.
8585

8686
```
87-
conda install -c plotly plotly=5.17.0
87+
conda install -c plotly plotly=5.18.0
8888
```
8989

9090
### JupyterLab Support
@@ -106,7 +106,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,
106106

107107
```
108108
# JupyterLab 2.x renderer support
109-
jupyter labextension install jupyterlab-plotly@5.17.0 @jupyter-widgets/jupyterlab-manager
109+
jupyter labextension install jupyterlab-plotly@5.18.0 @jupyter-widgets/jupyterlab-manager
110110
```
111111

112112
Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.

Diff for: binder/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jupytext
2-
plotly==5.17.0
2+
plotly==5.18.0
33
jupyter
44
notebook
55
pandas==1.0.3

Diff for: contributing.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,11 @@ pytest plotly/tests/test_plotly/test_plot.py::test_function
271271

272272
Running tests with tox is much more powerful, but requires a bit more setup.
273273

274-
You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 2.7` and
274+
You'll need to export an environment variable for *each* tox environment you wish to test with. For example, if you want to test with `Python 3.9` and
275275
`Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported:
276276

277277
```
278-
export PLOTLY_TOX_PYTHON_27=<python binary>
278+
export PLOTLY_TOX_PYTHON_39=<python binary>
279279
export PLOTLY_TOX_PYTHON_36=<python binary>
280280
```
281281

@@ -286,15 +286,15 @@ Where the `<python binary` is going to be specific to your development setup. As
286286
# tox envs #
287287
############
288288

289-
export PLOTLY_TOX_PYTHON_27=python2.7
290-
export PLOTLY_TOX_PYTHON_34=python3.4
291-
export TOXENV=py27-core,py34-core
289+
export PLOTLY_TOX_PYTHON_39=python3.9
290+
export PLOTLY_TOX_PYTHON_36=python3.6
291+
export TOXENV=py39-core,py36-core
292292
```
293293

294294
Where `TOXENV` is the environment list you want to use when invoking `tox` from the command line. Note that the `PLOTLY_TOX_*` pattern is used to pass in variables for use in the `tox.ini` file. Though this is a little setup, intensive, you'll get the following benefits:
295295

296296
* `tox` will automatically manage a virtual env for each environment you want to test in.
297-
* You only have to run `tox` and know that the module is working in both `Python 2` and `Python 3`.
297+
* You only have to run `tox` and know that the module is working in all included Python versions.
298298

299299
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:
300300

Diff for: doc/apidoc/conf.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Configuration file for the Sphinx documentation builder.
42
#
53
# This file does only contain a selection of the most common options. For a
@@ -28,7 +26,7 @@
2826
# The short X.Y version
2927
version = ""
3028
# The full version, including alpha/beta/rc tags
31-
release = "5.17.0"
29+
release = "5.18.0"
3230

3331

3432
# -- General configuration ---------------------------------------------------

Diff for: doc/python/3d-surface-plots.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fig.show()
7777
#### Surface Plot With Contours
7878

7979

80-
Display and customize contour data for each axis using the `contours` attribute ([reference](plotly.com/python/reference/surface/#surface-contours)).
80+
Display and customize contour data for each axis using the `contours` attribute ([reference](https://plotly.com/python/reference/surface/#surface-contours)).
8181

8282
```python
8383
import plotly.graph_objects as go

Diff for: doc/python/axes.md

+19
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,25 @@ fig.update_yaxes(range=[3, 9])
559559
fig.show()
560560
```
561561

562+
#### Exclude Inside Tick Labels from Range
563+
564+
*New in 5.18*
565+
566+
You can use `insiderange` instead of `range` on an axis if you have tick labels positioned on the inside of another axis and you don't want the range to overlap with those labels.
567+
568+
In this example, we have a y axis with `ticklabelposition="inside"` and by setting `insiderange=['2018-10-01', '2019-01-01']` on the x axis, the data point of `2018-10-01` is displayed after the y axis labels.
569+
570+
```python
571+
import plotly.express as px
572+
df = px.data.stocks(indexed=True)
573+
574+
fig = px.line(df, df.index, y="GOOG")
575+
fig.update_yaxes(ticklabelposition="inside", title="Price")
576+
fig.update_xaxes(insiderange=['2018-10-01', '2019-01-01'], title="Date")
577+
578+
fig.show()
579+
```
580+
562581
#### Setting only a Lower or Upper Bound for Range
563582

564583
*New in 5.17*

Diff for: doc/python/figure-labels.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ IFrame(snippet_url + 'figure-labels', width='100%', height=1200)
124124

125125
### Manual Labelling with Graph Objects
126126

127-
When using (graph objects)[/python/graph-objects/] rather than [Plotly Express](/python/plotly-express/), you will need to explicitly label traces and axes:
127+
When using [graph objects](/python/graph-objects/) rather than [Plotly Express](/python/plotly-express/), you will need to explicitly label traces and axes:
128128

129129
```python
130130
import plotly.graph_objects as go

Diff for: doc/python/getting-started.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
5858
`plotly` may be installed using `pip`:
5959

6060
```
61-
$ pip install plotly==5.17.0
61+
$ pip install plotly==5.18.0
6262
```
6363

6464
or `conda`:
6565

6666
```
67-
$ conda install -c plotly plotly=5.17.0
67+
$ conda install -c plotly plotly=5.18.0
6868
```
6969
This package contains everything you need to write figures to standalone HTML files.
7070

@@ -152,7 +152,7 @@ The instructions above apply to JupyterLab 3.x. **For JupyterLab 2 or earlier**,
152152

153153
```
154154
# JupyterLab 2.x renderer support
155-
jupyter labextension install jupyterlab-plotly@5.17.0 @jupyter-widgets/jupyterlab-manager
155+
jupyter labextension install jupyterlab-plotly@5.18.0 @jupyter-widgets/jupyterlab-manager
156156
```
157157

158158
Please check out our [Troubleshooting guide](/python/troubleshooting/) if you run into any problems with JupyterLab, particularly if you are using multiple python environments inside Jupyter.

Diff for: doc/python/tree-plots.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jupyter:
3535

3636
#### Set Up Tree with [igraph](http://igraph.org/python/)
3737

38-
Install igraph with `pip install python-igraph`.
38+
Install igraph with `pip install igraph`.
3939

4040
```python
41-
!pip install python-igraph
41+
!pip install igraph
4242
```
4343

4444
```python

Diff for: doc/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plotly==5.17.0
1+
plotly==5.18.0
22
jupytext==1.1.1
33
ipywidgets==7.7.2
44
jupyter-client<7
@@ -10,7 +10,7 @@ scipy==1.3.1
1010
patsy==0.5.1
1111
numpy==1.19.5
1212
plotly-geo
13-
python-igraph
13+
igraph
1414
geopandas==0.8.1
1515
pyshp==2.1.2
1616
shapely==1.7.1

Diff for: doc/unconverted/python/3d-network-graph.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Plotly's Python library is free and open source! [Get started](https://plot.ly/p
3333

3434

3535
We define our graph as an `igraph.Graph` object. [Python `igraph`](http://igraph.org/python/)
36-
is a library for high-performance graph generation and analysis. Install the Python library with `sudo pip install python-igraph`.
36+
is a library for high-performance graph generation and analysis. Install the Python library with `sudo pip install igraph`.
3737

3838
```python
3939
import igraph as ig

Diff for: doc/unconverted/python/amazon-redshift.md

-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ This notebook will go over one of the easiest ways to graph data from your [Amaz
4545
In this notebook we'll be using [Amazon's Sample Redshift Data](http://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-create-sample-db.html) for this notebook. Although we won't be connecting through a JDBC/ODBC connection we'll be using the [psycopg2 package](http://initd.org/psycopg/docs/index.html) with [SQLAlchemy](http://www.sqlalchemy.org/) and [pandas](http://pandas.pydata.org/) to make it simple to query and analyze our data.
4646

4747
```python
48-
from __future__ import print_function #python 3 support
49-
5048
import plotly.plotly as py
5149
import plotly.graph_objs as go
5250
import plotly.tools as tls

Diff for: doc/unconverted/python/apache-spark.md

-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ We can test for the Spark Context's existence with `print sc`.
122122
<!-- #endregion -->
123123

124124
```python
125-
from __future__ import print_function #python 3 support
126125
print(sc)
127126
```
128127

Diff for: doc/unconverted/python/chord-diagram.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Namely, if the distance(`V[i], V[j]`), belongs to the $K^{th}$ interval associat
5555

5656
We processed data provided by [Eurovision Song Contest](http://www.eurovision.tv/page/history/by-year/contest?event=2083#Scoreboard), and saved the corresponding graph in a `gml` file. Now we can read the `gml` file and define an [`igraph.Graph`](http://igraph.org/python/) object.
5757

58-
Install the Python libraries with `sudo pip install python-igraph` and `sudo pip install networkx`.
58+
Install the Python libraries with `sudo pip install igraph` and `sudo pip install networkx`.
5959

6060
```python
6161
import igraph as ig

Diff for: doc/unconverted/python/igraph-networkx-comparison.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Plotly's Python library is free and open source! [Get started](https://plot.ly/p
3131

3232

3333
#### Comparison
34-
In this tutorial we plot the same network - the coauthorship network of scientists working on network theory and experiment - first as an `igraph.Graph` object, with the Kamada-Kawai layout, and then as a `networkx.Graph`, with the Fruchterman-Reingold layout. Install the Python libraries with `sudo pip install python-igraph` and `sudo pip install networkx`.
34+
In this tutorial we plot the same network - the coauthorship network of scientists working on network theory and experiment - first as an `igraph.Graph` object, with the Kamada-Kawai layout, and then as a `networkx.Graph`, with the Fruchterman-Reingold layout. Install the Python libraries with `sudo pip install igraph` and `sudo pip install networkx`.
3535

3636
The graph data are read from a gml file, posted at UC Irvine [Network Data Repository](http://networkdata.ics.uci.edu/data/netscience/netscience.gml):
3737

Diff for: packages/javascript/jupyterlab-plotly/package-lock.json

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/javascript/jupyterlab-plotly/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab-plotly",
3-
"version": "5.17.0",
3+
"version": "5.18.0",
44
"description": "The plotly Jupyter extension",
55
"author": "The plotly.py team",
66
"license": "MIT",
@@ -65,7 +65,7 @@
6565
"@lumino/messaging": "^1.2.3",
6666
"@lumino/widgets": "^1.8.1",
6767
"lodash": "^4.17.4",
68-
"plotly.js": "^2.26.0"
68+
"plotly.js": "^2.27.0"
6969
},
7070
"jupyterlab": {
7171
"extension": "lib/jupyterlab-plugin",

Diff for: packages/python/plotly/_plotly_utils/basevalidators.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
import base64
42
import numbers
53
import textwrap
@@ -9,6 +7,7 @@
97
import io
108
import re
119
import sys
10+
import warnings
1211

1312
from _plotly_utils.optional_imports import get_module
1413

@@ -102,7 +101,11 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
102101
elif v.dtype.kind == "M":
103102
# Convert datetime Series/Index to numpy array of datetimes
104103
if isinstance(v, pd.Series):
105-
v = v.dt.to_pydatetime()
104+
with warnings.catch_warnings():
105+
warnings.simplefilter("ignore", FutureWarning)
106+
# Series.dt.to_pydatetime will return Index[object]
107+
# https://github.com/pandas-dev/pandas/pull/52459
108+
v = np.array(v.dt.to_pydatetime())
106109
else:
107110
# DatetimeIndex
108111
v = v.to_pydatetime()
@@ -111,7 +114,13 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
111114
if dtype.kind in numeric_kinds:
112115
v = v.values
113116
elif dtype.kind == "M":
114-
v = [row.dt.to_pydatetime().tolist() for i, row in v.iterrows()]
117+
with warnings.catch_warnings():
118+
warnings.simplefilter("ignore", FutureWarning)
119+
# Series.dt.to_pydatetime will return Index[object]
120+
# https://github.com/pandas-dev/pandas/pull/52459
121+
v = [
122+
np.array(row.dt.to_pydatetime()).tolist() for i, row in v.iterrows()
123+
]
115124

116125
if not isinstance(v, np.ndarray):
117126
# v has its own logic on how to convert itself into a numpy array
@@ -146,7 +155,7 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
146155
# --------------------------
147156
if force_numeric and new_v.dtype.kind not in numeric_kinds:
148157
raise ValueError(
149-
"Input value is not numeric and" "force_numeric parameter set to True"
158+
"Input value is not numeric and force_numeric parameter set to True"
150159
)
151160

152161
if "U" not in kind:

Diff for: packages/python/plotly/_plotly_utils/colors/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
Be careful! If you have a lot of unique numbers in your color column you will
7474
end up with a colormap that is massive and may slow down graphing performance.
7575
"""
76-
from __future__ import absolute_import
77-
7876
import decimal
7977
from numbers import Number
8078

Diff for: packages/python/plotly/_plotly_utils/optional_imports.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Stand-alone module to provide information about whether optional deps exist.
33
44
"""
5-
from __future__ import absolute_import
6-
75
from importlib import import_module
86
import logging
97
import sys
@@ -30,7 +28,7 @@ def get_module(name, should_load=True):
3028
return import_module(name)
3129
except ImportError:
3230
_not_importable.add(name)
33-
except Exception as e:
31+
except Exception:
3432
_not_importable.add(name)
3533
msg = f"Error importing optional module {name}"
3634
logger.exception(msg)

0 commit comments

Comments
 (0)