Skip to content

Commit f3557f5

Browse files
new px landing page
1 parent 92aa592 commit f3557f5

File tree

1 file changed

+54
-91
lines changed

1 file changed

+54
-91
lines changed

doc/python/plotly-express.md

Lines changed: 54 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -43,49 +43,42 @@ Plotly Express provides [more than 30 functions for creating different types of
4343

4444
Plotly Express currently includes the following functions:
4545

46-
* **Basics**: [`scatter`](https://plotly.com/python/line-and-scatter/), [`line`](https://plotly.com/python/line-charts/), [`area`](https://plotly.com/python/filled-area-plots/), [`bar`](https://plotly.com/python/bar-charts/), [`funnel`](https://plotly.com/python/funnel-charts/)
47-
* **Part-of-Whole**: [`pie`](https://plotly.com/python/pie-charts/), [`sunburst`](https://plotly.com/python/sunburst-charts/), [`treemap`](https://plotly.com/python/treemaps/), [`funnel_area`](https://plotly.com/python/funnel-charts/)
48-
* **1D Distributions**: [`histogram`](https://plotly.com/python/histograms/), [`box`](https://plotly.com/python/box-plots/), [`violin`](https://plotly.com/python/violin/), `strip`
49-
* **2D Distributions**: [`density_heatmap`](https://plotly.com/python/2D-Histogram/), [`density_contour`](https://plotly.com/python/2d-histogram-contour/)
50-
* **Matrix Input**: [`imshow`](https://plotly.com/python/imshow/)
51-
* **3-Dimensional**: [`scatter_3d`](https://plotly.com/python/3d-scatter-plots/), [`line_3d`](https://plotly.com/python/3d-line-plots/)
52-
* **Multidimensional**: [`scatter_matrix`](https://plotly.com/python/splom/), [`parallel_coordinates`](https://plotly.com/python/parallel-coordinates-plot/), [`parallel_categories`](https://plotly.com/python/parallel-categories-diagram/)
53-
* **Tile Maps**: [`scatter_mapbox`](https://plotly.com/python/scattermapbox/), [`line_mapbox`](https://plotly.com/python/lines-on-mapbox/), [`choropleth_mapbox`](https://plotly.com/python/mapbox-county-choropleth/), [`density_mapbox`](https://plotly.com/python/mapbox-density-heatmaps/)
54-
* **Outline Maps**: [`scatter_geo`](https://plotly.com/python/scatter-plots-on-maps/), [`line_geo`](https://plotly.com/python/lines-on-maps/), [`choropleth`](https://plotly.com/python/choropleth-maps/)
55-
* **Polar Charts**: [`scatter_polar`](https://plotly.com/python/polar-chart/), [`line_polar`](https://plotly.com/python/polar-chart/), [`bar_polar`](https://plotly.com/python/wind-rose-charts/)
56-
* **Ternary Charts**: [`scatter_ternary`](https://plotly.com/python/ternary-plots/), [`line_ternary`](https://plotly.com/python/ternary-plots/)
46+
* **Basics**: [`scatter`](/python/line-and-scatter/), [`line`](/python/line-charts/), [`area`](/python/filled-area-plots/), [`bar`](/python/bar-charts/), [`funnel`](/python/funnel-charts/)
47+
* **Part-of-Whole**: [`pie`](/python/pie-charts/), [`sunburst`](/python/sunburst-charts/), [`treemap`](/python/treemaps/), [`funnel_area`](/python/funnel-charts/)
48+
* **1D Distributions**: [`histogram`](/python/histograms/), [`box`](/python/box-plots/), [`violin`](/python/violin/), `strip`
49+
* **2D Distributions**: [`density_heatmap`](/python/2D-Histogram/), [`density_contour`](/python/2d-histogram-contour/)
50+
* **Matrix Input**: [`imshow`](/python/imshow/)
51+
* **3-Dimensional**: [`scatter_3d`](/python/3d-scatter-plots/), [`line_3d`](/python/3d-line-plots/)
52+
* **Multidimensional**: [`scatter_matrix`](/python/splom/), [`parallel_coordinates`](/python/parallel-coordinates-plot/), [`parallel_categories`](/python/parallel-categories-diagram/)
53+
* **Tile Maps**: [`scatter_mapbox`](/python/scattermapbox/), [`line_mapbox`](/python/lines-on-mapbox/), [`choropleth_mapbox`](/python/mapbox-county-choropleth/), [`density_mapbox`](/python/mapbox-density-heatmaps/)
54+
* **Outline Maps**: [`scatter_geo`](/python/scatter-plots-on-maps/), [`line_geo`](/python/lines-on-maps/), [`choropleth`](/python/choropleth-maps/)
55+
* **Polar Charts**: [`scatter_polar`](/python/polar-chart/), [`line_polar`](/python/polar-chart/), [`bar_polar`](/python/wind-rose-charts/)
56+
* **Ternary Charts**: [`scatter_ternary`](/python/ternary-plots/), [`line_ternary`](/python/ternary-plots/)
5757

5858
### High-Level Features
5959

6060
The Plotly Express API in general offers the following features::
6161

6262
* **A single entry point into `plotly`**: just `import plotly.express as px` and get access to [all the plotting functions](https://plotly.com/python-api-reference/plotly.express.html), plus [built-in demo datasets under `px.data`](https://plotly.com/python-api-reference/generated/plotly.data.html#module-plotly.data) and [built-in color scales and sequences under `px.color`](https://plotly.com/python-api-reference/generated/plotly.colors.html#module-plotly.colors)
6363
* **Sensible, Overrideable Defaults**: PX functions will infer sensible defaults wherever possible, and will always let you override them.
64-
* **Flexible Input Formats**: PX functions [accept input in a variety of formats](https://plotly.com/python/px-arguments/), from `list`s and `dict`s to [long-form or wide-form Pandas `DataFrame`s](https://plotly.com/python/wide-form/) to [`numpy` arrays and `xarrays`](https://plotly.com/python/imshow/) to [GeoPandas `GeoDataFrames`](https://plotly.com/python/maps/).
65-
* **Styling Control**: PX functions [read styling information from the default figure template](https://plotly.com/python/styling-plotly-express/), and support commonly-needed [cosmetic controls like `category_orders` and `color_discrete_map`](https://plotly.com/python/styling-plotly-express/) to precisely control categorical variables.
66-
* **Figure Labelling**: PX functions label axes, legends and colorbars based in the input `DataFrame` or `xarray`, and provide [extra control with the `labels` argument](https://plotly.com/python/styling-plotly-express/).
67-
* **Hover-labels**: PX functions populate the hover-label using the labels mentioned above, and provide [extra control with the `hover_name` and `hover_data` arguments](https://plotly.com/python/hover-text-and-formatting/).
68-
* **Uniform Color Handling**: PX functions automatically switch between [continuous](https://plotly.com/python/colorscales/) and [categorical color](https://plotly.com/python/discrete-color/) based on the input type.
69-
* **Faceting**: the 2D-cartesian plotting functions support [row, column and wrapped facetting with `facet_row`, `facet_col` and `facet_col_wrap` arguments](https://plotly.com/python/facet-plots/).
64+
* **Flexible Input Formats**: PX functions [accept input in a variety of formats](/python/px-arguments/), from `list`s and `dict`s to [long-form or wide-form Pandas `DataFrame`s](/python/wide-form/) to [`numpy` arrays and `xarrays`](/python/imshow/) to [GeoPandas `GeoDataFrames`](/python/maps/).
65+
* **Styling Control**: PX functions [read styling information from the default figure template](/python/styling-plotly-express/), and support commonly-needed [cosmetic controls like `category_orders` and `color_discrete_map`](/python/styling-plotly-express/) to precisely control categorical variables.
66+
* **Figure Labelling**: PX functions label axes, legends and colorbars based in the input `DataFrame` or `xarray`, and provide [extra control with the `labels` argument](/python/styling-plotly-express/).
67+
* **Hover-labels**: PX functions populate the hover-label using the labels mentioned above, and provide [extra control with the `hover_name` and `hover_data` arguments](/python/hover-text-and-formatting/).
68+
* **Uniform Color Handling**: PX functions automatically switch between [continuous](/python/colorscales/) and [categorical color](/python/discrete-color/) based on the input type.
69+
* **Faceting**: the 2D-cartesian plotting functions support [row, column and wrapped facetting with `facet_row`, `facet_col` and `facet_col_wrap` arguments](/python/facet-plots/).
7070
* **Marginal Plots**: the 2D-cartesian plotting functions support marginal distribution plots with the `marginal`, `marginal_x` and `marginal_y` arguments.
71-
* **A Pandas backend**: the 2D-cartesian plotting functions are available as [a Pandas plotting backend](https://plotly.com/python/pandas-backend/) so you can call them via `df.plot()`.
72-
* **Trendlines**: `px.scatter` supports [built-in trendlines with accessible model output](https://plotly.com/python/linear-fits/).
73-
* **Animations**: many PX functions support [simple animation support via the `animation_frame` and `animation_group` arguments](https://plotly.com/python/animations/).
71+
* **A Pandas backend**: the 2D-cartesian plotting functions are available as [a Pandas plotting backend](/python/pandas-backend/) so you can call them via `df.plot()`.
72+
* **Trendlines**: `px.scatter` supports [built-in trendlines with accessible model output](/python/linear-fits/).
73+
* **Animations**: many PX functions support [simple animation support via the `animation_frame` and `animation_group` arguments](/python/animations/).
7474

7575
### Gallery
7676

7777
The following set of figures is just a sampling of what can be done with Plotly Express.
7878

7979
#### Scatter, Line, Area and Bar Charts
8080

81-
Read more about [scatter plots](https://plotly.com/python/line-and-scatter/) and [discrete color](https://plotly.com/python/discrete-color/).
82-
83-
```python
84-
import plotly.express as px
85-
df = px.data.iris()
86-
fig = px.scatter(df, x="sepal_width", y="sepal_length")
87-
fig.show()
88-
```
81+
Read more about [scatter plots](/python/line-and-scatter/) and [discrete color](/python/discrete-color/).
8982

9083
```python
9184
import plotly.express as px
@@ -94,24 +87,17 @@ fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
9487
fig.show()
9588
```
9689

97-
```python
98-
import plotly.express as px
99-
df = px.data.iris()
100-
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", marginal_y="rug", marginal_x="histogram")
101-
fig
102-
```
103-
104-
Read more about [trendlines](https://plotly.com/python/linear-fits/).
90+
Read more about [trendlines](/python/linear-fits/) and [templates](/python/templates/).
10591

10692
```python
10793
import plotly.express as px
10894
df = px.data.iris()
10995
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", marginal_y="violin",
110-
marginal_x="box", trendline="ols")
96+
marginal_x="box", trendline="ols", template="simple_white")
11197
fig.show()
11298
```
11399

114-
Read more about [error bars](https://plotly.com/python/error-bars/).
100+
Read more about [error bars](/python/error-bars/).
115101

116102
```python
117103
import plotly.express as px
@@ -121,15 +107,7 @@ fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", error_x
121107
fig.show()
122108
```
123109

124-
```python
125-
import plotly.express as px
126-
df = px.data.tips()
127-
fig = px.scatter(df, x="total_bill", y="tip", facet_row="time", facet_col="day", color="smoker", trendline="ols",
128-
category_orders={"day": ["Thur", "Fri", "Sat", "Sun"], "time": ["Lunch", "Dinner"]})
129-
fig.show()
130-
```
131-
132-
Read more about [bar charts](https://plotly.com/python/bar-charts/).
110+
Read more about [bar charts](/python/bar-charts/).
133111

134112
```python
135113
import plotly.express as px
@@ -138,6 +116,8 @@ fig = px.bar(df, x="sex", y="total_bill", color="smoker", barmode="group")
138116
fig.show()
139117
```
140118

119+
Read more about [facet plots](/python/facet-plots/).
120+
141121
```python
142122
import plotly.express as px
143123
df = px.data.tips()
@@ -146,14 +126,8 @@ fig = px.bar(df, x="sex", y="total_bill", color="smoker", barmode="group", facet
146126
fig.show()
147127
```
148128

149-
Read more about [scatterplot matrices (SPLOMs)](https://plotly.com/python/splom/).
129+
Read more about [scatterplot matrices (SPLOMs)](/python/splom/).
150130

151-
```python
152-
import plotly.express as px
153-
df = px.data.iris()
154-
fig = px.scatter_matrix(df)
155-
fig.show()
156-
```
157131

158132
```python
159133
import plotly.express as px
@@ -162,7 +136,7 @@ fig = px.scatter_matrix(df, dimensions=["sepal_width", "sepal_length", "petal_wi
162136
fig.show()
163137
```
164138

165-
Read more about [parallel coordinates](https://plotly.com/python/parallel-coordinates-plot/) and [parallel categories](https://plotly.com/python/parallel-categories-diagram/), as well as [continuous color](https://plotly.com/python/colorscales/).
139+
Read more about [parallel coordinates](/python/parallel-coordinates-plot/) and [parallel categories](/python/parallel-categories-diagram/), as well as [continuous color](/python/colorscales/).
166140

167141
```python
168142
import plotly.express as px
@@ -181,17 +155,7 @@ fig = px.parallel_categories(df, color="size", color_continuous_scale=px.colors.
181155
fig.show()
182156
```
183157

184-
Read more about [facet plots](https://plotly.com/python/facet-plots/).
185-
186-
```python
187-
import plotly.express as px
188-
df = px.data.tips()
189-
fig = px.scatter(df, x="total_bill", y="tip", color="size", facet_col="sex",
190-
color_continuous_scale=px.colors.sequential.Viridis, render_mode="webgl")
191-
fig.show()
192-
```
193-
194-
Read more about [hover labels](https://plotly.com/python/hover-text-and-formatting/).
158+
Read more about [hover labels](/python/hover-text-and-formatting/).
195159

196160
```python
197161
import plotly.express as px
@@ -201,7 +165,7 @@ fig = px.scatter(df.query("year==2007"), x="gdpPercap", y="lifeExp", size="pop",
201165
fig.show()
202166
```
203167

204-
Read more about [animations](https://plotly.com/python/animations/).
168+
Read more about [animations](/python/animations/).
205169

206170
```python
207171
import plotly.express as px
@@ -212,7 +176,7 @@ fig = px.scatter(df, x="gdpPercap", y="lifeExp", animation_frame="year", animati
212176
fig.show()
213177
```
214178

215-
Read more about [line charts](https://plotly.com/python/line-charts/).
179+
Read more about [line charts](/python/line-charts/).
216180

217181
```python
218182
import plotly.express as px
@@ -222,7 +186,7 @@ fig = px.line(df, x="year", y="lifeExp", color="continent", line_group="country"
222186
fig.show()
223187
```
224188

225-
Read more about [area charts](https://plotly.com/python/filled-area-plots/).
189+
Read more about [area charts](/python/filled-area-plots/).
226190

227191
```python
228192
import plotly.express as px
@@ -233,7 +197,7 @@ fig.show()
233197

234198
### Part to Whole Charts
235199

236-
Read more about [pie charts](https://plotly.com/python/pie-charts/).
200+
Read more about [pie charts](/python/pie-charts/).
237201

238202
```python
239203
import plotly.express as px
@@ -243,7 +207,7 @@ fig = px.pie(df, values='pop', names='country', title='Population of European co
243207
fig.show()
244208
```
245209

246-
Read more about [sunburst charts](https://plotly.com/python/sunburst-charts/).
210+
Read more about [sunburst charts](/python/sunburst-charts/).
247211

248212
```python
249213
import plotly.express as px
@@ -254,7 +218,7 @@ fig = px.sunburst(df, path=['continent', 'country'], values='pop',
254218
fig.show()
255219
```
256220

257-
Read more about [treemaps](https://plotly.com/python/treemaps/).
221+
Read more about [treemaps](/python/treemaps/).
258222

259223
```python
260224
import plotly.express as px
@@ -267,7 +231,7 @@ fig.show()
267231

268232
#### Distributions
269233

270-
Read more about [histograms](https://plotly.com/python/histograms/).
234+
Read more about [histograms](/python/histograms/).
271235

272236
```python
273237
import plotly.express as px
@@ -285,7 +249,7 @@ fig = px.histogram(df, x="sex", y="tip", histfunc="avg", color="smoker", barmode
285249
fig.show()
286250
```
287251

288-
Read more about [box plots](https://plotly.com/python/box-plots/).
252+
Read more about [box plots](/python/box-plots/).
289253

290254
```python
291255
import plotly.express as px
@@ -294,7 +258,7 @@ fig = px.box(df, x="day", y="total_bill", color="smoker", notched=True)
294258
fig.show()
295259
```
296260

297-
Read more about [violin plots](https://plotly.com/python/violin/).
261+
Read more about [violin plots](/python/violin/).
298262

299263
```python
300264
import plotly.express as px
@@ -310,7 +274,7 @@ fig = px.strip(df, x="total_bill", y="time", orientation="h", color="smoker")
310274
fig.show()
311275
```
312276

313-
Read more about [density contours, also known as 2D histogram contours](https://plotly.com/python/2d-histogram-contour/).
277+
Read more about [density contours, also known as 2D histogram contours](/python/2d-histogram-contour/).
314278

315279
```python
316280
import plotly.express as px
@@ -326,7 +290,7 @@ fig = px.density_contour(df, x="sepal_width", y="sepal_length", color="species",
326290
fig.show()
327291
```
328292

329-
Read more about [density heatmaps, also known as 2D histograms](https://plotly.com/python/2D-Histogram/).
293+
Read more about [density heatmaps, also known as 2D histograms](/python/2D-Histogram/).
330294

331295
```python
332296
import plotly.express as px
@@ -337,7 +301,7 @@ fig.show()
337301

338302
### Images and Heatmaps
339303

340-
Read more about [heatmaps and images](https://plotly.com/python/imshow/).
304+
Read more about [heatmaps and images](/python/imshow/).
341305

342306
```python
343307
import plotly.express as px
@@ -360,26 +324,25 @@ fig.show()
360324

361325
#### Maps
362326

363-
Read more about [tile maps](https://plotly.com/python/mapbox-layers/) and [point](https://plotly.com/python/scattermapbox/) and [line](https://plotly.com/python/lines-on-mapbox/) maps.
327+
Read more about [tile maps](/python/mapbox-layers/) and [point](/python/scattermapbox/) and [line](/python/lines-on-mapbox/) maps.
364328

365329
```python
366330
import plotly.express as px
367-
px.set_mapbox_access_token(open(".mapbox_token").read())
368331
df = px.data.carshare()
369-
fig = px.scatter_mapbox(df, lat="centroid_lat", lon="centroid_lon", color="peak_hour", size="car_hours",
370-
color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=10)
332+
fig = px.scatter_mapbox(df, lat="centroid_lat", lon="centroid_lon", color="peak_hour", size="car_hours",
333+
color_continuous_scale=px.colors.cyclical.IceFire, size_max=15, zoom=10,
334+
mapbox_style="carto-positron")
371335
fig.show()
372336
```
373337

374338
```python
375339
import plotly.express as px
376-
px.set_mapbox_access_token(open(".mapbox_token").read())
377340
df = px.data.carshare()
378-
fig = px.line_mapbox(df, lat="centroid_lat", lon="centroid_lon", color="peak_hour")
341+
fig = px.line_mapbox(df, lat="centroid_lat", lon="centroid_lon", color="peak_hour", mapbox_style="carto-positron")
379342
fig.show()
380343
```
381344

382-
Read more about [tile map GeoJSON choropleths](https://plotly.com/python/mapbox-county-choropleth/).
345+
Read more about [tile map GeoJSON choropleths](/python/mapbox-county-choropleth/).
383346

384347
```python
385348
import plotly.express as px
@@ -394,7 +357,7 @@ fig = px.choropleth_mapbox(df, geojson=geojson, color="Bergeron",
394357
fig.show()
395358
```
396359

397-
Read more about [outline map scatter](https://plotly.com/python/scatter-plots-on-maps/) and [line plots](https://plotly.com/python/lines-on-maps/).
360+
Read more about [outline map scatter](/python/scatter-plots-on-maps/) and [line plots](/python/lines-on-maps/).
398361

399362
```python
400363
import plotly.express as px
@@ -412,7 +375,7 @@ fig.show()
412375
```
413376

414377

415-
Read more about [choropleth maps](https://plotly.com/python/choropleth-maps/).
378+
Read more about [choropleth maps](/python/choropleth-maps/).
416379

417380
```python
418381
import plotly.express as px
@@ -424,7 +387,7 @@ fig.show()
424387

425388
#### Polar Coordinates
426389

427-
Read more about [polar plots](https://plotly.com/python/polar-chart/).
390+
Read more about [polar plots](/python/polar-chart/).
428391

429392
```python
430393
import plotly.express as px
@@ -442,7 +405,7 @@ fig = px.line_polar(df, r="frequency", theta="direction", color="strength", line
442405
fig.show()
443406
```
444407

445-
Read more about [polar bar charts](https://plotly.com/python/wind-rose-charts/).
408+
Read more about [polar bar charts](/python/wind-rose-charts/).
446409

447410
```python
448411
import plotly.express as px
@@ -454,7 +417,7 @@ fig.show()
454417

455418
#### 3D Coordinates
456419

457-
Read more about [3D scatter plots](https://plotly.com/python/3d-scatter-plots/) and [3D line plots](https://plotly.com/python/3d-line-plots/).
420+
Read more about [3D scatter plots](/python/3d-scatter-plots/) and [3D line plots](/python/3d-line-plots/).
458421

459422
```python
460423
import plotly.express as px
@@ -473,7 +436,7 @@ fig.show()
473436

474437
#### Ternary Coordinates
475438

476-
Read more about [ternary charts](https://plotly.com/python/ternary-plots/).
439+
Read more about [ternary charts](/python/ternary-plots/).
477440

478441
```python
479442
import plotly.express as px

0 commit comments

Comments
 (0)