Skip to content

Merge master to doc-prod #4399

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 21 commits into from
Oct 25, 2023
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,21 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [5.18.0] - 2023-10-25

### Updated
- 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:
- 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!
- Fix column order changes on hover [[#6718](https://github.com/plotly/plotly.js/pull/6718)],
with thanks to @bhavinpatel1109 for the contribution!
- Fix hover at timestamp '1970-01-01 00:00:00' [[#6752](https://github.com/plotly/plotly.js/pull/6752)],
with thanks to @adamjhawley for the contribution!
- Fix clearing empty `candlestick` using react [[#6757](https://github.com/plotly/plotly.js/pull/6757)]

### Fixed
- Repair crash on Matplotlib 3.8 related to get_offset_position [[#4372](https://github.com/plotly/plotly.py/pull/4372)],
- 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)]

## [5.17.0] - 2023-09-15

### Updated
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@

## Quickstart

`pip install plotly==5.17.0`
`pip install plotly==5.18.0`

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

@@ -78,13 +78,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==5.17.0
pip install plotly==5.18.0
```

or conda.

```
conda install -c plotly plotly=5.17.0
conda install -c plotly plotly=5.18.0
```

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.17.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.18.0 @jupyter-widgets/jupyterlab-manager
```

Please check out our [Troubleshooting guide](https://plotly.com/python/troubleshooting/) if you run into any problems with JupyterLab.
2 changes: 1 addition & 1 deletion binder/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
jupytext
plotly==5.17.0
plotly==5.18.0
jupyter
notebook
pandas==1.0.3
12 changes: 6 additions & 6 deletions contributing.md
Original file line number Diff line number Diff line change
@@ -271,11 +271,11 @@ pytest plotly/tests/test_plotly/test_plot.py::test_function

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

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
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
`Python 3.6`, but only care to check the `core` specs, you would need to ensure that the following variables are exported:

```
export PLOTLY_TOX_PYTHON_27=<python binary>
export PLOTLY_TOX_PYTHON_39=<python binary>
export PLOTLY_TOX_PYTHON_36=<python binary>
```

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

export PLOTLY_TOX_PYTHON_27=python2.7
export PLOTLY_TOX_PYTHON_34=python3.4
export TOXENV=py27-core,py34-core
export PLOTLY_TOX_PYTHON_39=python3.9
export PLOTLY_TOX_PYTHON_36=python3.6
export TOXENV=py39-core,py36-core
```

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:

* `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`.
* You only have to run `tox` and know that the module is working in all included Python versions.

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:

4 changes: 1 addition & 3 deletions doc/apidoc/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
@@ -28,7 +26,7 @@
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "5.17.0"
release = "5.18.0"


# -- General configuration ---------------------------------------------------
19 changes: 19 additions & 0 deletions doc/python/axes.md
Original file line number Diff line number Diff line change
@@ -559,6 +559,25 @@ fig.update_yaxes(range=[3, 9])
fig.show()
```

#### Exclude Inside Tick Labels from Range

*New in 5.18*

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.

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.

```python
import plotly.express as px
df = px.data.stocks(indexed=True)

fig = px.line(df, df.index, y="GOOG")
fig.update_yaxes(ticklabelposition="inside", title="Price")
fig.update_xaxes(insiderange=['2018-10-01', '2019-01-01'], title="Date")

fig.show()
```

#### Setting only a Lower or Upper Bound for Range

*New in 5.17*
6 changes: 3 additions & 3 deletions doc/python/getting-started.md
Original file line number Diff line number Diff line change
@@ -58,13 +58,13 @@ We also encourage you to join the [Plotly Community Forum](http://community.plot
`plotly` may be installed using `pip`:

```
$ pip install plotly==5.17.0
$ pip install plotly==5.18.0
```

or `conda`:

```
$ conda install -c plotly plotly=5.17.0
$ conda install -c plotly plotly=5.18.0
```
This package contains everything you need to write figures to standalone HTML files.

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

```
# JupyterLab 2.x renderer support
jupyter labextension install jupyterlab-plotly@5.17.0 @jupyter-widgets/jupyterlab-manager
jupyter labextension install jupyterlab-plotly@5.18.0 @jupyter-widgets/jupyterlab-manager
```

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.
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
plotly==5.17.0
plotly==5.18.0
jupytext==1.1.1
ipywidgets==7.7.2
jupyter-client<7
2 changes: 0 additions & 2 deletions doc/unconverted/python/amazon-redshift.md
Original file line number Diff line number Diff line change
@@ -45,8 +45,6 @@ This notebook will go over one of the easiest ways to graph data from your [Amaz
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.

```python
from __future__ import print_function #python 3 support

import plotly.plotly as py
import plotly.graph_objs as go
import plotly.tools as tls
1 change: 0 additions & 1 deletion doc/unconverted/python/apache-spark.md
Original file line number Diff line number Diff line change
@@ -122,7 +122,6 @@ We can test for the Spark Context's existence with `print sc`.
<!-- #endregion -->

```python
from __future__ import print_function #python 3 support
print(sc)
```

18 changes: 9 additions & 9 deletions packages/javascript/jupyterlab-plotly/package-lock.json

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

4 changes: 2 additions & 2 deletions packages/javascript/jupyterlab-plotly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jupyterlab-plotly",
"version": "5.17.0",
"version": "5.18.0",
"description": "The plotly Jupyter extension",
"author": "The plotly.py team",
"license": "MIT",
@@ -65,7 +65,7 @@
"@lumino/messaging": "^1.2.3",
"@lumino/widgets": "^1.8.1",
"lodash": "^4.17.4",
"plotly.js": "^2.26.0"
"plotly.js": "^2.27.0"
},
"jupyterlab": {
"extension": "lib/jupyterlab-plugin",
19 changes: 14 additions & 5 deletions packages/python/plotly/_plotly_utils/basevalidators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import absolute_import

import base64
import numbers
import textwrap
@@ -9,6 +7,7 @@
import io
import re
import sys
import warnings

from _plotly_utils.optional_imports import get_module

@@ -102,7 +101,11 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
elif v.dtype.kind == "M":
# Convert datetime Series/Index to numpy array of datetimes
if isinstance(v, pd.Series):
v = v.dt.to_pydatetime()
with warnings.catch_warnings():
warnings.simplefilter("ignore", FutureWarning)
# Series.dt.to_pydatetime will return Index[object]
# https://github.com/pandas-dev/pandas/pull/52459
v = np.array(v.dt.to_pydatetime())
else:
# DatetimeIndex
v = v.to_pydatetime()
@@ -111,7 +114,13 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
if dtype.kind in numeric_kinds:
v = v.values
elif dtype.kind == "M":
v = [row.dt.to_pydatetime().tolist() for i, row in v.iterrows()]
with warnings.catch_warnings():
warnings.simplefilter("ignore", FutureWarning)
# Series.dt.to_pydatetime will return Index[object]
# https://github.com/pandas-dev/pandas/pull/52459
v = [
np.array(row.dt.to_pydatetime()).tolist() for i, row in v.iterrows()
]

if not isinstance(v, np.ndarray):
# 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):
# --------------------------
if force_numeric and new_v.dtype.kind not in numeric_kinds:
raise ValueError(
"Input value is not numeric and" "force_numeric parameter set to True"
"Input value is not numeric and force_numeric parameter set to True"
)

if "U" not in kind:
2 changes: 0 additions & 2 deletions packages/python/plotly/_plotly_utils/colors/__init__.py
Original file line number Diff line number Diff line change
@@ -73,8 +73,6 @@
Be careful! If you have a lot of unique numbers in your color column you will
end up with a colormap that is massive and may slow down graphing performance.
"""
from __future__ import absolute_import

import decimal
from numbers import Number

4 changes: 1 addition & 3 deletions packages/python/plotly/_plotly_utils/optional_imports.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
Stand-alone module to provide information about whether optional deps exist.

"""
from __future__ import absolute_import

from importlib import import_module
import logging
import sys
@@ -30,7 +28,7 @@ def get_module(name, should_load=True):
return import_module(name)
except ImportError:
_not_importable.add(name)
except Exception as e:
except Exception:
_not_importable.add(name)
msg = f"Error importing optional module {name}"
logger.exception(msg)
3 changes: 0 additions & 3 deletions packages/python/plotly/_plotly_utils/utils.py
Original file line number Diff line number Diff line change
@@ -8,9 +8,6 @@
from _plotly_utils.basevalidators import ImageUriValidator


PY36_OR_LATER = sys.version_info >= (3, 6)


def cumsum(x):
"""
Custom cumsum to avoid a numpy import.
30 changes: 30 additions & 0 deletions packages/python/plotly/codegen/resources/plot-schema.json
Original file line number Diff line number Diff line change
@@ -10892,6 +10892,21 @@
"editType": "none",
"valType": "string"
},
"insiderange": {
"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.",
"editType": "plot",
"items": [
{
"editType": "plot",
"valType": "any"
},
{
"editType": "plot",
"valType": "any"
}
],
"valType": "info_array"
},
"labelalias": {
"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.",
"dflt": false,
@@ -12217,6 +12232,21 @@
"editType": "none",
"valType": "string"
},
"insiderange": {
"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.",
"editType": "plot",
"items": [
{
"editType": "plot",
"valType": "any"
},
{
"editType": "plot",
"valType": "any"
}
],
"valType": "info_array"
},
"labelalias": {
"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.",
"dflt": false,
1 change: 0 additions & 1 deletion packages/python/plotly/plotly/__init__.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@
- exceptions: defines our custom exception classes

"""
from __future__ import absolute_import
import sys
from typing import TYPE_CHECKING
from _plotly_utils.importers import relative_import
3 changes: 0 additions & 3 deletions packages/python/plotly/plotly/_subplots.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

# Constants
# ---------
# Subplot types that are each individually positioned with a domain
Loading