Skip to content

Commit 65e3b39

Browse files
authored
Merge branch 'main' into marthacryan-patch-1
2 parents c2a34e8 + f27f38f commit 65e3b39

File tree

168 files changed

+5807
-2158
lines changed

Some content is hidden

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

168 files changed

+5807
-2158
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
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+
## Unreleased
6+
7+
## [6.3.0] - 2025-08-12
8+
9+
### Updated
10+
- Updated Plotly.js from version 3.0.1 to version 3.1.0. See the plotly.js [release notes](https://github.com/plotly/plotly.js/releases) for more information. [[#5318](https://github.com/plotly/plotly.py/pull/5318)]
11+
12+
### Added
13+
- Exposed `plotly.io.get_chrome()` as a function which can be called from within a Python script. [[#5282](https://github.com/plotly/plotly.py/pull/5282)]
14+
15+
### Fixed
16+
- Resolved issue causing extraneous engine deprecation warnings [[#5287](https://github.com/plotly/plotly.py/pull/5287)], with thanks to @jdbeel for the contribution!
17+
518
## [6.2.0] - 2025-06-26
619

720
### Added

CITATION.cff

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ authors:
99
- family-names: "Parmer"
1010
given-names: "Chris"
1111
title: "An interactive, open-source, and browser-based graphing library for Python"
12-
version: 5.24.1
12+
version: 6.3.0
1313
doi: 10.5281/zenodo.14503524
14-
date-released: 2024-09-12
14+
date-released: 2025-08-12
1515
url: "https://github.com/plotly/plotly.py"
16+

codegen/datatypes.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"choroplethmapbox",
1111
"densitymapbox",
1212
]
13+
locationmode_traces = [
14+
"choropleth",
15+
"scattergeo",
16+
]
1317

1418

1519
def get_typing_type(plotly_type, array_ok=False):
@@ -100,6 +104,7 @@ def build_datatype_py(node):
100104

101105
if (
102106
node.name_property in deprecated_mapbox_traces
107+
or node.name_property in locationmode_traces
103108
or node.name_property == "template"
104109
):
105110
buffer.write("import warnings\n")
@@ -341,6 +346,27 @@ def __init__(self"""
341346
constructor must be a dict or
342347
an instance of :class:`{class_name}`\"\"\")
343348
349+
"""
350+
)
351+
352+
# Add warning for 'country names' locationmode
353+
if node.name_property in locationmode_traces:
354+
buffer.write(
355+
f"""
356+
if locationmode == "country names" and kwargs.get("_validate"):
357+
warnings.warn(
358+
"The library used by the *country names* `locationmode` option is changing in an upcoming version. "
359+
"Country names in existing plots may not work in the new version. "
360+
"To ensure consistent behavior, consider setting `locationmode` to *ISO-3*.",
361+
DeprecationWarning,
362+
stacklevel=5,
363+
)
364+
365+
"""
366+
)
367+
368+
buffer.write(
369+
f"""
344370
self._skip_invalid = kwargs.pop("skip_invalid", False)
345371
self._validate = kwargs.pop("_validate", True)
346372
"""

codegen/resources/plot-schema.json

Lines changed: 601 additions & 102 deletions
Large diffs are not rendered by default.

commands.py

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -244,27 +244,10 @@ def update_plotlyjs(plotly_js_version, outdir):
244244

245245

246246
# FIXME: switch to argparse
247-
def update_schema_bundle_from_master():
247+
def update_schema_bundle_from_master(args):
248248
"""Update the plotly.js schema and bundle from master."""
249-
250-
if "--devrepo" in sys.argv:
251-
devrepo = sys.argv[sys.argv.index("--devrepo") + 1]
252-
else:
253-
devrepo = "plotly/plotly.js"
254-
255-
if "--devbranch" in sys.argv:
256-
devbranch = sys.argv[sys.argv.index("--devbranch") + 1]
257-
else:
258-
devbranch = "master"
259-
260-
if "--local" in sys.argv:
261-
local = sys.argv[sys.argv.index("--local") + 1]
262-
else:
263-
local = None
264-
265-
if local is None:
266-
build_info = get_latest_publish_build_info(devrepo, devbranch)
267-
249+
if args.local is None:
250+
build_info = get_latest_publish_build_info(args.devrepo, args.devbranch)
268251
archive_url, bundle_url, schema_url = get_bundle_schema_urls(
269252
build_info["build_num"]
270253
)
@@ -275,14 +258,14 @@ def update_schema_bundle_from_master():
275258
# Update schema in package data
276259
overwrite_schema(schema_url)
277260
else:
278-
# this info could be more informative but
279-
# it doesn't seem as useful in a local context
280-
# and requires dependencies and programming.
261+
# this info could be more informative but it doesn't seem as
262+
# useful in a local context and requires dependencies and
263+
# programming.
281264
build_info = {"vcs_revision": "local", "committer_date": str(time.time())}
282-
devrepo = local
283-
devbranch = ""
265+
args.devrepo = args.local
266+
args.devbranch = ""
284267

285-
archive_uri, bundle_uri, schema_uri = get_bundle_schema_local(local)
268+
archive_uri, bundle_uri, schema_uri = get_bundle_schema_local(args.local)
286269
overwrite_bundle_local(bundle_uri)
287270
overwrite_schema_local(schema_uri)
288271

@@ -293,23 +276,23 @@ def update_schema_bundle_from_master():
293276

294277
# Replace version with bundle url
295278
package_json["dependencies"]["plotly.js"] = (
296-
archive_url if local is None else archive_uri
279+
archive_url if args.local is None else archive_uri
297280
)
298281
with open(package_json_path, "w") as f:
299282
json.dump(package_json, f, indent=2)
300283

301284
# update plotly.js version in _plotlyjs_version
302285
rev = build_info["vcs_revision"]
303286
date = str(build_info["committer_date"])
304-
version = "_".join([devrepo, devbranch, date[:10], rev[:8]])
287+
version = "_".join([args.devrepo, args.devbranch, date[:10], rev[:8]])
305288
overwrite_plotlyjs_version_file(version)
306-
install_js_deps(local)
289+
install_js_deps(args.local)
307290

308291

309-
def update_plotlyjs_dev(outdir):
292+
def update_plotlyjs_dev(args, outdir):
310293
"""Update project to a new development version of plotly.js."""
311294

312-
update_schema_bundle_from_master()
295+
update_schema_bundle_from_master(args)
313296
perform_codegen(outdir)
314297

315298

@@ -328,7 +311,14 @@ def parse_args():
328311

329312
subparsers.add_parser("format", help="reformat code")
330313

331-
subparsers.add_parser("updateplotlyjsdev", help="update plotly.js for development")
314+
p_update_dev = subparsers.add_parser(
315+
"updateplotlyjsdev", help="update plotly.js for development"
316+
)
317+
p_update_dev.add_argument(
318+
"--devrepo", default="plotly/plotly.js", help="repository"
319+
)
320+
p_update_dev.add_argument("--devbranch", default="master", help="branch")
321+
p_update_dev.add_argument("--local", default=None, help="local path")
332322

333323
subparsers.add_parser("updateplotlyjs", help="update plotly.js")
334324

@@ -353,7 +343,7 @@ def main():
353343
lint_code(outdir)
354344

355345
elif args.cmd == "updateplotlyjsdev":
356-
update_plotlyjs_dev(outdir)
346+
update_plotlyjs_dev(args, outdir)
357347

358348
elif args.cmd == "updateplotlyjs":
359349
version = plotly_js_version()

doc/apidoc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# The short X.Y version
2525
version = ""
2626
# The full version, including alpha/beta/rc tags
27-
release = "6.2.0"
27+
release = "6.3.0"
2828

2929

3030
# -- General configuration ---------------------------------------------------

doc/python/3d-mesh.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ Whereas the previous example used the default `intensitymode='vertex'`, we plot
154154

155155
```python
156156
import plotly.graph_objects as go
157+
import numpy as np
158+
157159
fig = go.Figure(data=[
158160
go.Mesh3d(
159161
# 8 vertices of a cube

doc/python/axes.md

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupyter:
66
extension: .md
77
format_name: markdown
88
format_version: '1.3'
9-
jupytext_version: 1.16.3
9+
jupytext_version: 1.17.2
1010
kernelspec:
1111
display_name: Python 3 (ipykernel)
1212
language: python
@@ -20,7 +20,7 @@ jupyter:
2020
name: python
2121
nbconvert_exporter: python
2222
pygments_lexer: ipython3
23-
version: 3.10.14
23+
version: 3.9.0
2424
plotly:
2525
description: How to adjust axes properties in Python - axes titles, styling and
2626
coloring axes and grid lines, ticks, tick labels and more.
@@ -118,7 +118,7 @@ The PX `labels` argument can also be used without a data frame argument:
118118

119119
```python
120120
import plotly.express as px
121-
fig = px.bar(df, x=["Apples", "Oranges"], y=[10,20], color=["Here", "There"],
121+
fig = px.bar(x=["Apples", "Oranges"], y=[10,20], color=["Here", "There"],
122122
labels=dict(x="Fruit", y="Amount", color="Place")
123123
)
124124
fig.show()
@@ -460,6 +460,7 @@ Here, `ticklabelstandoff=15` moves the labels 15 pixels further away from the x-
460460

461461
```python
462462
import plotly.express as px
463+
import pandas as pd
463464

464465
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
465466

@@ -487,6 +488,7 @@ To draw the label for the minor tick before each major tick, set `ticklabelindex
487488

488489
```python
489490
import plotly.express as px
491+
import pandas as pd
490492

491493
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv')
492494

@@ -619,6 +621,38 @@ fig.update_yaxes(zeroline=True, zerolinewidth=2, zerolinecolor='LightPink')
619621
fig.show()
620622
```
621623

624+
##### Controlling Zero Line Layer
625+
626+
*New in 6.3*
627+
628+
By default, zero lines are displayed below traces. Set `zerolinelayer="above traces"` on an axis to display its zero line above traces:
629+
630+
```python
631+
import plotly.graph_objects as go
632+
633+
x = ['A', 'B', 'C', 'D', 'A']
634+
y = [2, 0, 4, -3, 2]
635+
636+
fig = go.Figure(
637+
data=[
638+
go.Scatter(
639+
x=x,
640+
y=y,
641+
fill='toself',
642+
mode='none',
643+
fillcolor='lightpink'
644+
)
645+
],
646+
layout=dict(
647+
yaxis=dict(
648+
zerolinelayer="above traces" # Change to "below traces" to see the difference
649+
),
650+
)
651+
)
652+
653+
fig.show()
654+
```
655+
622656
#### Setting the Range of Axes Manually
623657

624658
The visible x and y axis range can be configured manually by setting the `range` axis property to a list of two values, the lower and upper bound.

doc/python/box-plots.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ fig.show()
448448

449449
```python
450450
import plotly.graph_objects as go
451+
import numpy as np
451452

452453
x_data = ['Carmelo Anthony', 'Dwyane Wade',
453454
'Deron Williams', 'Brook Lopez',

doc/python/choropleth-maps.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,16 @@ fig.show()
208208
Plotly comes with two built-in geometries which do not require an external GeoJSON file:
209209

210210
1. USA States
211-
2. Countries as defined in the Natural Earth dataset.
211+
2. Countries
212212

213-
**Note and disclaimer:** cultural (as opposed to physical) features are by definition subject to change, debate and dispute. Plotly includes data from Natural Earth "as-is" and defers to the [Natural Earth policy regarding disputed borders](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/) which read:
213+
In **Plotly.py 6.3 and later**, the built-in countries geometry is created from the following sources:
214+
- [UN data](https://geoportal.un.org/arcgis/sharing/rest/content/items/d7caaff3ef4b4f7c82689b7c4694ad92/data) for country borders, coastlines, land, and ocean layers.
215+
- Natural Earth data for lakes, rivers, and subunits layers.
214216

215-
> Natural Earth Vector draws boundaries of countries according to defacto status. We show who actually controls the situation on the ground.
217+
In **earlier versions of Plotly.py**, the built-in countries geometry is based on Natural Earth data only. Plotly includes data from Natural Earth "as-is". This dataset draws boundaries of countries according to de facto status. See the [Natural Earth page for more details](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/).
216218

217219
To use the built-in countries geometry, provide `locations` as [three-letter ISO country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3).
218220

219-
220221
```python
221222
import plotly.express as px
222223

0 commit comments

Comments
 (0)