You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,14 @@
2
2
All notable changes to this project will be documented in this file.
3
3
This project adheres to [Semantic Versioning](http://semver.org/).
4
4
5
+
## Unreleased
6
+
7
+
### Updated
8
+
- Updated Plotly.js from version 3.0.1 to version 3.0.3. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#303----2025-07-23) for more information.
9
+
10
+
### Added
11
+
- 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)]
Copy file name to clipboardExpand all lines: doc/python/choropleth-maps.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,7 +214,7 @@ In **Plotly.py 6.3 and later**, the built-in countries geometry is created from
214
214
-[UN data](https://geoportal.un.org/arcgis/sharing/rest/content/items/d7caaff3ef4b4f7c82689b7c4694ad92/data) for country borders, coastlines, and land layers.
215
215
- Natural Earth data for oceans, lakes, rivers, and subunit layers.
216
216
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 defacto status. See the [Natural Earth page for more details](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/).
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/).
218
218
219
219
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).
Copy file name to clipboardExpand all lines: doc/python/figurewidget.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ jupyter:
22
22
pygments_lexer: ipython3
23
23
version: 3.6.5
24
24
plotly:
25
-
description: Introduction to the new Plotly FigureWidget
25
+
description: Introduction to the Plotly FigureWidget
26
26
display_as: chart_events
27
27
language: python
28
28
layout: base
@@ -34,6 +34,12 @@ jupyter:
34
34
redirect_from: /python/ipython-widgets/
35
35
---
36
36
37
+
The Plotly FigureWidget allows you to add Plotly charts as interactive widgets in Jupyter and other compatible notebooks. To use the FigureWidget, you'll need to install `anywidget`:
Swarm plots show the distribution of values in a column by giving each entry one dot and adjusting the y-value so that dots do not overlap and appear symmetrically around the y=0 line. They complement [histograms](https://plotly.com/python/histograms/), [box plots](https://plotly.com/python/box-plots/), and [violin plots](https://plotly.com/python/violin/). This example could be generalized to implement a swarm plot for multiple categories by adjusting the y-coordinate for each category.
290
+
291
+
```python
292
+
import pandas as pd
293
+
import plotly.express as px
294
+
import collections
295
+
296
+
297
+
defnegative_1_if_count_is_odd(count):
298
+
# if this is an odd numbered entry in its bin, make its y coordinate negative
299
+
# the y coordinate of the first entry is 0, so entries 3, 5, and 7 get
300
+
# negative y coordinates
301
+
if count %2==1:
302
+
return-1
303
+
else:
304
+
return1
305
+
306
+
307
+
defswarm(
308
+
X_series,
309
+
fig_title,
310
+
point_size=16,
311
+
fig_width=800,
312
+
gap_multiplier=1.2,
313
+
bin_fraction=0.95, # slightly undersizes the bins to avoid collisions
314
+
):
315
+
# sorting will align columns in attractive c-shaped arcs rather than having
316
+
# columns that vary unpredictably in the x-dimension.
317
+
# We also exploit the fact that sorting means we see bins sequentially when
318
+
# we add collision prevention offsets.
319
+
X_series = X_series.copy().sort_values()
320
+
321
+
# we need to reason in terms of the marker size that is measured in px
322
+
# so we need to think about each x-coordinate as being a fraction of the way from the
323
+
# minimum X value to the maximum X value
324
+
min_x =min(X_series)
325
+
max_x =max(X_series)
326
+
327
+
list_of_rows = []
328
+
# we will count the number of points in each "bin" / vertical strip of the graph
329
+
# to be able to assign a y-coordinate that avoids overlapping
330
+
bin_counter = collections.Counter()
331
+
332
+
for x_val in X_series:
333
+
# assign this x_value to bin number
334
+
# each bin is a vertical strip slightly narrower than one marker
# remember the "y-slot" which tells us the number of points in this bin and is sufficient to compute the y coordinate unless there's a collision with the point to its left
If Plotly Express does not provide a good starting point, it is possible to use [the more generic `go.Scatter` class from `plotly.graph_objects`](/python/graph-objects/). Whereas `plotly.express` has two functions `scatter` and `line`, `go.Scatter` can be used both for plotting points (makers) or lines, depending on the value of `mode`. The different options of `go.Scatter` are documented in its [reference page](https://plotly.com/python/reference/scatter/).
Copy file name to clipboardExpand all lines: doc/python/map-configuration.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,13 +51,13 @@ Geo maps are outline-based maps. If your figure is created with a `px.scatter_ge
51
51
52
52
### Physical Base Maps
53
53
54
-
Plotly Geo maps have a built-in base map layer composed of "physical" and "cultural" (i.e. administrative border) data.
54
+
Plotly Geo maps have a built-in base map layer composed of *physical* and *cultural* (i.e. administrative border) data.
55
55
56
56
In **Plotly.py 6.3 and later**, the base map layer is created from the following sources:
57
57
-[UN data](https://geoportal.un.org/arcgis/sharing/rest/content/items/d7caaff3ef4b4f7c82689b7c4694ad92/data) for country borders, coastlines, and land layers.
58
58
- Natural Earth data for oceans, lakes, rivers, and subunit layers.
59
59
60
-
In **earlier versions of Plotly.py**, the base map layer is based on Natural Earth data only. Plotly includes data from Natural Earth "as-is". This dataset draws boundaries of countries according to defacto status. See the [Natural Earth page for more details](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/).
60
+
In **earlier versions of Plotly.py**, the base map layer 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/).
61
61
62
62
Various lines and area fills can be shown or hidden, and their color and line-widths specified. In the [default `plotly` template](/python/templates/), a map frame and physical features such as a coastal outline and filled land areas are shown, at a small-scale 1:110m resolution:
63
63
@@ -112,7 +112,7 @@ In addition to physical base map features, a "cultural" base map is included whi
112
112
113
113
In **Plotly.py 6.3 and later**, this base map is created from [UN data](https://geoportal.un.org/arcgis/sharing/rest/content/items/d7caaff3ef4b4f7c82689b7c4694ad92/data) for country borders, and Natural Earth data for sub-country borders.
114
114
115
-
In **earlier versions of Plotly.py**, this base map is based only on Natural Earth data. Plotly includes data from Natural Earth "as-is". This dataset draws boundaries of countries according to defacto status. See the [Natural Earth page for more details](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/).
115
+
In **earlier versions of Plotly.py**, this base map is based on Natural Earth data only. Plotly includes data from Natural Earth "as-is". This dataset draws boundaries of countries according to defacto status. See the [Natural Earth page for more details](https://www.naturalearthdata.com/downloads/50m-cultural-vectors/50m-admin-0-countries-2/).
116
116
117
117
**To create a map with your own cultural features** please refer to our [choropleth documentation](/python/choropleth-maps/).
Copy file name to clipboardExpand all lines: doc/python/static-image-export.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,12 +64,12 @@ Plotly also provides a CLI for installing Chrome from the command line.
64
64
65
65
Run `plotly_get_chrome` to install Chrome.
66
66
67
-
You can also install Chrome from within Python using `plotly.io.install_chrome()`
67
+
You can also install Chrome from Python using `plotly.io.get_chrome()`
68
68
69
69
```python
70
70
import plotly.io as pio
71
71
72
-
pio.install_chrome()
72
+
pio.get_chrome()
73
73
```
74
74
75
75
See the **Additional Information on Browsers with Kaleido** section below for more details on browser compatibility for Kaleido.
@@ -273,6 +273,8 @@ The following settings are available.
273
273
274
274
`mathjax`: Location of the MathJax bundle needed to render LaTeX characters. Defaults to a CDN location. If fully offline export is required, set this to a local MathJax bundle.
275
275
276
+
`plotlyjs`: Location of the Plotly.js bundle to use. Can be a local file path or URL. By default, Kaleido uses the Plotly.js bundle included with Plotly.py.
277
+
276
278
`topojson`: Location of the topojson files needed to render choropleth traces. Defaults to a CDN location. If fully offline export is required, set this to a local directory containing the Plotly.js topojson files.
277
279
278
280
`mapbox_access_token`: The default Mapbox access token (Kaleido v0 only). Mapbox traces are deprecated. See the [MapLibre Migration](https://plotly.com/python/mapbox-to-maplibre/) page for more details.
Copy file name to clipboardExpand all lines: doc/python/tile-county-choropleth.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ jupyter:
22
22
pygments_lexer: ipython3
23
23
version: 3.10.0
24
24
plotly:
25
-
description: How to make a choropleth map of US counties in Python with Plotly.
25
+
description: How to make tile choropleth maps in Python with Plotly.
26
26
display_as: maps
27
27
language: python
28
28
layout: base
@@ -254,4 +254,4 @@ fig.show()
254
254
255
255
See [function reference for `px.choropleth_map`](https://plotly.com/python-api-reference/generated/plotly.express.choropleth_map) or https://plotly.com/python/reference/choroplethmap/ for more information about the attributes available.
256
256
257
-
For Mapbox-based tile maps, see [function reference for `px.choropleth_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.choropleth_mapbox) or https://plotly.com/python/reference/choroplethmapbox/.
257
+
For (deprecated) Mapbox-based tile maps, see [function reference for `px.choropleth_mapbox`](https://plotly.com/python-api-reference/generated/plotly.express.choropleth_mapbox) or https://plotly.com/python/reference/choroplethmapbox/.
0 commit comments