Skip to content

Commit a6f2210

Browse files
authored
Merge branch 'master' into doc-prod-v5.18.0
2 parents cf64bca + 5327970 commit a6f2210

File tree

132 files changed

+323
-397
lines changed

Some content is hidden

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

132 files changed

+323
-397
lines changed

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

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.

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

doc/apidoc/conf.py

-2
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

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*

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

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

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.

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",

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:

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

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)

packages/python/plotly/_plotly_utils/utils.py

-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
from _plotly_utils.basevalidators import ImageUriValidator
99

1010

11-
PY36_OR_LATER = sys.version_info >= (3, 6)
12-
13-
1411
def cumsum(x):
1512
"""
1613
Custom cumsum to avoid a numpy import.

packages/python/plotly/codegen/resources/plot-schema.json

+30
Original file line numberDiff line numberDiff line change
@@ -10892,6 +10892,21 @@
1089210892
"editType": "none",
1089310893
"valType": "string"
1089410894
},
10895+
"insiderange": {
10896+
"description": "Could be used to set the desired inside range of this axis (excluding the labels) when `ticklabelposition` of the anchored axis has *inside*. Not implemented for axes with `type` *log*. This would be ignored when `range` is provided.",
10897+
"editType": "plot",
10898+
"items": [
10899+
{
10900+
"editType": "plot",
10901+
"valType": "any"
10902+
},
10903+
{
10904+
"editType": "plot",
10905+
"valType": "any"
10906+
}
10907+
],
10908+
"valType": "info_array"
10909+
},
1089510910
"labelalias": {
1089610911
"description": "Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. For negative numbers the minus sign symbol used (U+2212) is wider than the regular ascii dash. That means you need to use −1 instead of -1. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax.",
1089710912
"dflt": false,
@@ -12217,6 +12232,21 @@
1221712232
"editType": "none",
1221812233
"valType": "string"
1221912234
},
12235+
"insiderange": {
12236+
"description": "Could be used to set the desired inside range of this axis (excluding the labels) when `ticklabelposition` of the anchored axis has *inside*. Not implemented for axes with `type` *log*. This would be ignored when `range` is provided.",
12237+
"editType": "plot",
12238+
"items": [
12239+
{
12240+
"editType": "plot",
12241+
"valType": "any"
12242+
},
12243+
{
12244+
"editType": "plot",
12245+
"valType": "any"
12246+
}
12247+
],
12248+
"valType": "info_array"
12249+
},
1222012250
"labelalias": {
1222112251
"description": "Replacement text for specific tick or hover labels. For example using {US: 'USA', CA: 'Canada'} changes US to USA and CA to Canada. The labels we would have shown must match the keys exactly, after adding any tickprefix or ticksuffix. For negative numbers the minus sign symbol used (U+2212) is wider than the regular ascii dash. That means you need to use −1 instead of -1. labelalias can be used with any axis type, and both keys (if needed) and values (if desired) can include html-like tags or MathJax.",
1222212252
"dflt": false,

packages/python/plotly/plotly/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
- exceptions: defines our custom exception classes
2626
2727
"""
28-
from __future__ import absolute_import
2928
import sys
3029
from typing import TYPE_CHECKING
3130
from _plotly_utils.importers import relative_import

packages/python/plotly/plotly/_subplots.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import absolute_import, unicode_literals
3-
41
# Constants
52
# ---------
63
# Subplot types that are each individually positioned with a domain

packages/python/plotly/plotly/_widget_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# for automated dev builds
33
#
44
# It is edited by hand prior to official releases
5-
__frontend_version__ = "^5.17.0"
5+
__frontend_version__ = "^5.18.0"
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
from _plotly_future_ import _chart_studio_error
32

43
_chart_studio_error("api.utils")
-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
from _plotly_future_ import _chart_studio_error
32

43
_chart_studio_error("api.v1")
-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import absolute_import
21
from _plotly_future_ import _chart_studio_error
32

43
_chart_studio_error("api.v2")

packages/python/plotly/plotly/basedatatypes.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import absolute_import
2-
31
import collections
42
from collections import OrderedDict
53
import re

packages/python/plotly/plotly/basewidget.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
import uuid
2-
from importlib import import_module
3-
import os
4-
import numbers
5-
6-
try:
7-
from urllib import parse
8-
except ImportError:
9-
from urlparse import urlparse as parse
10-
111
import ipywidgets as widgets
122
from traitlets import List, Unicode, Dict, observe, Integer
3+
134
from .basedatatypes import BaseFigure, BasePlotlyType
145
from .callbacks import BoxSelector, LassoSelector, InputDeviceState, Points
156
from .serializers import custom_serializers

0 commit comments

Comments
 (0)