diff --git a/contributing.md b/contributing.md index 09989e2296e..82ed16b20ba 100644 --- a/contributing.md +++ b/contributing.md @@ -213,7 +213,7 @@ This is the release process for releasing `plotly.py` version `X.Y.Z` with `plotlywidget` version `A.B.C`. Note: The `plotlywidget` instructions must be followed if any change -has been made in the `js/` directory source code, OR if the version of +has been made in the `packages/javascript` directory source code, OR if the version of plotly.js has been updated. If neither of these is the case, there's no need to increment the `plotlywidget` version or to publish a new version to npm. @@ -253,7 +253,9 @@ Note that the conda installation instructions must include "-c plotly/lable/test" rather than "-c plotly" in order to install the release candidate version. -Commit Changelog and README updates. +Update the `doc/python/getting-started.md` file with the same version numbers. + +Commit Changelog, README and getting-started updates. ### Bump to release candidate version 1) Manually update the plotlywidget version to `A.B.C-rc.1` in the files @@ -297,17 +299,19 @@ And, you'll need the credentials file `~/.pypirc`. Request access from (plotly_dev) $ twine upload dist/plotly-X.Y.Zrc1* ``` -### Publish release candidate of `plotlywidget` to NPM +### Publish release candidate of `plotlywidget` and `jupyterlab-plotly` to NPM Now, publish the release candidate of the `plotlywidget` NPM package. ```bash -cd ./js +cd ./packages/javascript/plotlywidget npm publish --access public --tag next ``` The `--tag next` part ensures that users won't install this version unless they explicitly ask for the version or for the version wtih the `next` tag. +Do the same in the `jupyterlab-plotly` directory. + ### Publish release candidate to plotly anaconda channel To publish package to the plotly anaconda channel you'll need to have the anaconda or miniconda distribution installed, and you'll need to have the @@ -361,7 +365,9 @@ release candidate suffix from the following version strings: - `plotly/_widget_version.py`: + Update `__frontend_version__` to `^A.B.C` (Note the `^` prefix) - - `js/package.json` + - `packages/javascript/plotlywidget/package.json` + + Update `"version"` to `A.B.C` + - `packages/javascript/jupyterlab-plotly/package.json` + Update `"version"` to `A.B.C` Commit and push to the release branch. @@ -431,6 +437,19 @@ Make "Release title" the same string as the tag. Copy changelog section for this version as the "Describe this release" +### Upgrade doc requirements and API doc + +Files to be updated: +- `doc/apidoc/conf.py` with new version number +- `doc/requirements.txt` +- `binder/requirements.txt` + +### Synchronize master and doc-prod branches + +doc-prod should already have been merged on a regular basis into master, but +start doing it first. Then merge master into doc-prod to deploy the doc related +to features in the release. + ### Post announcement Post a simple announcement to the Plotly Python forum, with links to the README installation instructions and to the CHANGELOG. diff --git a/packages/python/plotly/plotly/express/_core.py b/packages/python/plotly/plotly/express/_core.py index dd670c26d40..db8f002c2c1 100644 --- a/packages/python/plotly/plotly/express/_core.py +++ b/packages/python/plotly/plotly/express/_core.py @@ -1024,6 +1024,7 @@ def build_dataframe(args, attrables, array_attrables): def _check_dataframe_all_leaves(df): df_sorted = df.sort_values(by=list(df.columns)) null_mask = df_sorted.isnull() + df_sorted = df_sorted.astype(str) null_indices = np.nonzero(null_mask.any(axis=1).values)[0] for null_row_index in null_indices: row = null_mask.iloc[null_row_index] @@ -1055,8 +1056,9 @@ def process_dataframe_hierarchy(args): if args["color"] and args["color"] in path: series_to_copy = df[args["color"]] - args["color"] = str(args["color"]) + "additional_col_for_px" - df[args["color"]] = series_to_copy + new_col_name = args["color"] + "additional_col_for_color" + path = [new_col_name if x == args["color"] else x for x in path] + df[new_col_name] = series_to_copy if args["hover_data"]: for col_name in args["hover_data"]: if col_name == args["color"]: @@ -1160,6 +1162,11 @@ def aggfunc_continuous(x): args["ids"] = "id" args["names"] = "labels" args["parents"] = "parent" + if args["color"]: + if not args["hover_data"]: + args["hover_data"] = [args["color"]] + else: + args["hover_data"].append(args["color"]) return args diff --git a/packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py b/packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py index 0393931af11..0fc38c94d4d 100644 --- a/packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py +++ b/packages/python/plotly/plotly/tests/test_core/test_px/test_px_functions.py @@ -209,14 +209,22 @@ def test_sunburst_treemap_with_path_color(): # Hover info df["hover"] = [el.lower() for el in vendors] fig = px.sunburst(df, path=path, color="calls", hover_data=["hover"]) - custom = fig.data[0].customdata.ravel() - assert np.all(custom[:8] == df["hover"]) - assert np.all(custom[8:] == "(?)") + custom = fig.data[0].customdata + assert np.all(custom[:8, 0] == df["hover"]) + assert np.all(custom[8:, 0] == "(?)") + assert np.all(custom[:8, 1] == df["calls"]) # Discrete color fig = px.sunburst(df, path=path, color="vendors") assert len(np.unique(fig.data[0].marker.colors)) == 9 + # Numerical column in path + df["regions"] = df["regions"].map({"North": 1, "South": 2}) + path = ["total", "regions", "sectors", "vendors"] + fig = px.sunburst(df, path=path, values="values", color="calls") + colors = fig.data[0].marker.colors + assert np.all(np.array(colors[:8]) == np.array(calls)) + def test_sunburst_treemap_with_path_non_rectangular(): vendors = ["A", "B", "C", "D", None, "E", "F", "G", "H", None]