Skip to content

Commit 6c5cfe2

Browse files
doc tweaks
1 parent 34b7772 commit 6c5cfe2

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

doc/python/px-arguments.md

+16-14
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ jupyter:
3333
thumbnail: thumbnail/plotly-express.png
3434
---
3535

36-
### Column-oriented, Matrix or Geographic Data
36+
### Plotly Express works with Column-oriented, Matrix or Geographic Data
3737

3838
Plotly Express provides functions to visualize a variety of types of data. Most functions such as `px.bar` or `px.scatter` expect to operate on column-oriented data of the type you might store in a Pandas `DataFrame` (in either "long" or "wide" format, see below). [`px.imshow` operates on matrix-like data](/python/imshow/) you might store in a `numpy` or `xarray` array and functions like [`px.choropleth` and `px.choropleth_mapbox` can operate on geographic data](/python/maps/) of the kind you might store in a GeoPandas `GeoDataFrame`. This page details how to provide column-oriented data to most Plotly Express functions.
3939

4040

4141

42-
### Long-, Wide-, and Mixed-Form Data
42+
### Plotly Express works with Long-, Wide-, and Mixed-Form Data
4343

4444
*Until version 4.8, Plotly Express only operated on long-form (previously called "tidy") data, but [now accepts wide-form and mixed-form data](/python/wide-form/) as well.*
4545

4646
There are three common conventions for storing column-oriented data, usually in a data frame with column names:
4747

48-
* **long-form data** is suitable for storing multivariate data (i.e. dimensions greater than 2), with one row per observation, and one column per variable.
49-
* **wide-form data** is suitable for storing 2-dimensional data, with one row per value of one of the first variable, and one column per value of the second variable.
50-
* **mixed-form data** is a hybrid of long-form and wide-form data, with one row per value of one variable, and some columns representing values of another, and some columns representing more variables (see our [wide-form documentation](/python/wide-form/) for examples of how to use Plotly Express to visualize this kind of data)
48+
* **long-form data** has one row per observation, and one column per variable. This is suitable for storing and displaying multivariate data i.e. with dimension greater than 2. This format is sometimes called "tidy".
49+
* **wide-form data** has one row per value of one of the first variable, and one column per value of the second variable. This is suitable for storing and displaying 2-dimensional data.
50+
* **mixed-form data** is a hybrid of long-form and wide-form data, with one row per value of one variable, and some columns representing values of another, and some columns representing more variables. See the [wide-form documentation](/python/wide-form/) for examples of how to use Plotly Express to visualize this kind of data.
5151

52-
All Plotly Express functions can operate on long-form data, and the following 2D-Cartesian functions can operate on wide-form data as well:: `px.scatter`, `px.line`, `px.area`, `px.bar`, `px.histogram`, `px.violin`, `px.box`, `px.strip`, `px.funnel`, `px.density_heatmap` and `px.density_contour`. Read on for a short example of the differences between these forms, or check out our [detailed documentation about wide-form support](/python/wide-form/).
52+
Every Plotly Express function other than `imshow` can operate on long-form data, and in addition, the following 2D-Cartesian functions can operate on wide-form and mixed-form data: `px.scatter`, `px.line`, `px.area`, `px.bar`, `px.histogram`, `px.violin`, `px.box`, `px.strip`, `px.funnel`, `px.density_heatmap` and `px.density_contour`.
5353

5454
By way of example here is the same data, represented in long-form first, and then in wide-form:
5555

@@ -177,22 +177,24 @@ fig.show()
177177
```
178178

179179
```python
180+
import numpy as np
180181
import plotly.express as px
181182

182-
# List arguments in wide form
183-
series1 = [3, 5, 4, 8]
184-
series2 = [5, 4, 8, 3]
185-
fig = px.line(x=[1, 2, 3, 4], y=[series1, series2])
183+
t = np.linspace(0, 10, 100)
184+
# NumPy arrays arguments
185+
fig = px.scatter(x=t, y=np.sin(t), labels={'x':'t', 'y':'sin(t)'}) # override keyword names with labels
186186
fig.show()
187187
```
188188

189+
List arguments can also be passed in as a list of lists, which triggers [wide-form data processing](/python/wide-form/), with the downside that the resulting traces will need to be manually renamed via `fig.data[<n>].name = "name"`.
190+
189191
```python
190-
import numpy as np
191192
import plotly.express as px
192193

193-
t = np.linspace(0, 10, 100)
194-
# NumPy arrays arguments
195-
fig = px.scatter(x=t, y=np.sin(t), labels={'x':'t', 'y':'sin(t)'}) # override keyword names with labels
194+
# List arguments in wide form
195+
series1 = [3, 5, 4, 8]
196+
series2 = [5, 4, 8, 3]
197+
fig = px.line(x=[1, 2, 3, 4], y=[series1, series2])
196198
fig.show()
197199
```
198200

doc/python/wide-form.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,21 @@ jupyter:
3434
thumbnail: thumbnail/plotly-express.png
3535
---
3636

37-
### Plotly Express with Column-oriented, Matrix or Geographic Data
37+
### Plotly Express works with Column-oriented, Matrix or Geographic Data
3838

3939
Plotly Express provides functions to visualize a variety of types of data. Most functions such as `px.bar` or `px.scatter` expect to operate on column-oriented data of the type you might store in a Pandas `DataFrame` (in either "long" or "wide" format, see below). [`px.imshow` operates on matrix-like data](/python/imshow/) you might store in a `numpy` or `xarray` array and functions like [`px.choropleth` and `px.choropleth_mapbox` can operate on geographic data](/python/maps/) of the kind you might store in a GeoPandas `GeoDataFrame`. This page details how to provide a specific form of column-oriented data to 2D-Cartesian Plotly Express functions, but you can also check out our [detailed column-input-format documentation](/python/px-arguments/).
4040

41-
### Plotly Express with Long-, Wide-, and Mixed-Form Data
41+
### Plotly Express works with Long-, Wide-, and Mixed-Form Data
4242

4343
*Until version 4.8, Plotly Express only operated on long-form (previously called "tidy") data, but now accepts wide-form and mixed-form data as well.*
4444

4545
There are three common conventions for storing column-oriented data, usually in a data frame with column names:
4646

47-
* **long-form data** is suitable for storing multivariate data (i.e. dimensions greater than 2), with one row per observation, and one column per variable.
48-
* **wide-form data** is suitable for storing 2-dimensional data, with one row per value of one of the first variable, and one column per value of the second variable.
49-
* **mixed-form data** is a hybrid of long-form and wide-form data, with one row per value of one variable, and some columns representing values of another, and some columns representing more variables
47+
* **long-form data** has one row per observation, and one column per variable. This is suitable for storing and displaying multivariate data i.e. with dimension greater than 2. This format is sometimes called "tidy".
48+
* **wide-form data** has one row per value of one of the first variable, and one column per value of the second variable. This is suitable for storing and displaying 2-dimensional data.
49+
* **mixed-form data** is a hybrid of long-form and wide-form data, with one row per value of one variable, and some columns representing values of another, and some columns representing more variables.
5050

51-
All Plotly Express functions other than `imshow` can operate on long-form data, and in addition, the following 2D-Cartesian functions can operate on wide-form and mixed-form data: `px.scatter`, `px.line`, `px.area`, `px.bar`, `px.histogram`, `px.violin`, `px.box`, `px.strip`, `px.funnel`, `px.density_heatmap` and `px.density_contour`.
51+
Every Plotly Express function other than `imshow` can operate on long-form data, and in addition, the following 2D-Cartesian functions can operate on wide-form and mixed-form data: `px.scatter`, `px.line`, `px.area`, `px.bar`, `px.histogram`, `px.violin`, `px.box`, `px.strip`, `px.funnel`, `px.density_heatmap` and `px.density_contour`.
5252

5353
By way of example here is the same data, represented in long-form first, and then in wide-form:
5454

0 commit comments

Comments
 (0)