8000 Merge branch 'master' into doc-prod-v5.18.0 · rl-utility-man/plotly.py@a6f2210 · GitHub
[go: up one dir, main page]

8000
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

Lines changed: 15 additions & 0 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 0 additions & 2 deletions
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

Lines changed: 19 additions & 0 deletions
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/p C94A ython/amazon-redshift.md

Lines changed: 0 additions & 2 deletions
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

Lines changed: 0 additions & 1 deletion
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

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/javascript/jupyterlab-plotly/package.json

Lines changed: 2 additions & 2 deletions
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

Lines changed: 14 additions & 5 deletions
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:

0 commit comments

Comments
 (0)
0