Skip to content

Commit 2a9aafd

Browse files
Merge pull request #2156 from plotly/px_styling
finally: how to style px
2 parents 09b3b86 + ba950ef commit 2a9aafd

32 files changed

+282
-129
lines changed

Diff for: doc/python/3d-scatter-plots.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jupyter:
3535

3636
## 3D scatter plot with Plotly Express
3737

38-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
38+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
3939

4040
Like the [2D scatter plot](https://plot.ly/python/line-and-scatter/) `px.scatter`, the 3D function `px.scatter_3d` plots individual data in three-dimensional space.
4141

Diff for: doc/python/bar-charts.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
8+
format_version: "1.2"
99
jupytext_version: 1.3.0
1010
kernelspec:
1111
display_name: Python 3
@@ -35,7 +35,7 @@ jupyter:
3535

3636
### Bar chart with Plotly Express
3737

38-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
38+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
3939

4040
With `px.bar`, each row of the DataFrame is represented as a rectangular mark.
4141

Diff for: doc/python/box-plots.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
8+
format_version: "1.2"
99
jupytext_version: 1.3.1
1010
kernelspec:
1111
display_name: Python 3
@@ -31,16 +31,16 @@ jupyter:
3131
page_type: example_index
3232
permalink: python/box-plots/
3333
redirect_from:
34-
- /python/box/
35-
- /python/basic_statistics/
34+
- /python/box/
35+
- /python/basic_statistics/
3636
thumbnail: thumbnail/box.jpg
3737
---
3838

3939
A [box plot](https://en.wikipedia.org/wiki/Box_plot) is a statistical representation of numerical data through their quartiles. The ends of the box represent the lower and upper quartiles, while the median (second quartile) is marked by a line inside the box. For other statistical representations of numerical data, see [other statistical charts](https://plot.ly/python/statistical-charts/).
4040

4141
## Box Plot with `plotly.express`
4242

43-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
43+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4444

4545
In a box plot created by `px.box`, the distribution of the column given as `y` argument is represented.
4646

@@ -73,13 +73,13 @@ fig.show()
7373

7474
### Choosing The Algorithm For Computing Quartiles
7575

76-
By default, quartiles for box plots are computed using the `linear` method (for more about linear interpolation, see #10 listed on [http://www.amstat.org/publications/jse/v14n3/langford.html](http://www.amstat.org/publications/jse/v14n3/langford.html) and [https://en.wikipedia.org/wiki/Quartile](https://en.wikipedia.org/wiki/Quartile) for more details).
76+
By default, quartiles for box plots are computed using the `linear` method (for more about linear interpolation, see #10 listed on [http://www.amstat.org/publications/jse/v14n3/langford.html](http://www.amstat.org/publications/jse/v14n3/langford.html) and [https://en.wikipedia.org/wiki/Quartile](https://en.wikipedia.org/wiki/Quartile) for more details).
7777

78-
However, you can also choose to use an `exclusive` or an `inclusive` algorithm to compute quartiles.
78+
However, you can also choose to use an `exclusive` or an `inclusive` algorithm to compute quartiles.
7979

80-
The *exclusive* algorithm uses the median to divide the ordered dataset into two halves. If the sample is odd, it does not include the median in either half. Q1 is then the median of the lower half and Q3 is the median of the upper half.
80+
The _exclusive_ algorithm uses the median to divide the ordered dataset into two halves. If the sample is odd, it does not include the median in either half. Q1 is then the median of the lower half and Q3 is the median of the upper half.
8181

82-
The *inclusive* algorithm also uses the median to divide the ordered dataset into two halves, but if the sample is odd, it includes the median in both halves. Q1 is then the median of the lower half and Q3 the median of the upper half.
82+
The _inclusive_ algorithm also uses the median to divide the ordered dataset into two halves, but if the sample is odd, it includes the median in both halves. Q1 is then the median of the lower half and Q3 the median of the upper half.
8383

8484
```python
8585
import plotly.express as px
@@ -92,7 +92,8 @@ fig.show()
9292
```
9393

9494
#### Difference Between Quartile Algorithms
95-
It can sometimes be difficult to see the difference between the linear, inclusive, and exclusive algorithms for computing quartiles. In the following example, the same dataset is visualized using each of the three different quartile computation algorithms.
95+
96+
It can sometimes be difficult to see the difference between the linear, inclusive, and exclusive algorithms for computing quartiles. In the following example, the same dataset is visualized using each of the three different quartile computation algorithms.
9697

9798
```python
9899
import plotly.express as px
@@ -103,7 +104,7 @@ df = pd.DataFrame(dict(
103104
linear=data,
104105
inclusive=data,
105106
exclusive=data
106-
)).melt(var_name="quartilemethod")
107+
)).melt(var_name="quartilemethod")
107108

108109

109110
fig = px.box(df, y="value", facet_col="quartilemethod", color="quartilemethod",
@@ -204,7 +205,7 @@ fig.show()
204205

205206
You can specify precomputed quartile attributes rather than using a built-in quartile computation algorithm.
206207

207-
This could be useful if you have already pre-computed those values or if you need to use a different algorithm than the ones provided.
208+
This could be useful if you have already pre-computed those values or if you need to use a different algorithm than the ones provided.
208209

209210
```python
210211
import plotly.graph_objects as go
@@ -217,9 +218,9 @@ fig.add_trace(go.Box(y=[
217218
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
218219
], name="Precompiled Quartiles"))
219220

220-
fig.update_traces(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ],
221-
q3=[ 7, 8, 9 ], lowerfence=[-1, 0, 1],
222-
upperfence=[5, 6, 7], mean=[ 2.2, 2.8, 3.2 ],
221+
fig.update_traces(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ],
222+
q3=[ 7, 8, 9 ], lowerfence=[-1, 0, 1],
223+
upperfence=[5, 6, 7], mean=[ 2.2, 2.8, 3.2 ],
223224
sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ] )
224225

225226
fig.show()

Diff for: doc/python/bubble-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jupyter:
3838

3939
A [bubble chart](https://en.wikipedia.org/wiki/Bubble_chart) is a scatter plot in which a third dimension of the data is shown through the size of markers. For other types of scatter plot, see the [line and scatter page](https://plot.ly/python/line-and-scatter/).
4040

41-
We first show a bubble chart example using Plotly Express. [Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/). The size of markers is set from the dataframe column given as the `size` parameter.
41+
We first show a bubble chart example using Plotly Express. [Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). The size of markers is set from the dataframe column given as the `size` parameter.
4242

4343
```python
4444
import plotly.express as px

Diff for: doc/python/bubble-maps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Plotly figures made with `px.scatter_geo`, `px.line_geo` or `px.choropleth` func
3939

4040
### Bubble map with Plotly Express
4141

42-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/). With `px.scatter_geo`, each line of the dataframe is represented as a marker point. The column set as the `size` argument gives the size of markers.
42+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). With `px.scatter_geo`, each line of the dataframe is represented as a marker point. The column set as the `size` argument gives the size of markers.
4343

4444
```python
4545
import plotly.express as px

Diff for: doc/python/choropleth-maps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The GeoJSON data is passed to the `geojson` argument, and the data is passed int
5656

5757
### Choropleth Map with plotly.express
5858

59-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
59+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
6060

6161
#### GeoJSON with `feature.id`
6262

Diff for: doc/python/distplot.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jupyter:
3737

3838
Several representations of statistical distributions are available in plotly, such as [histograms](https://plot.ly/python/histograms/), [violin plots](https://plot.ly/python/violin/), [box plots](https://plot.ly/python/box-plots/) (see [the complete list here](https://plot.ly/python/statistical-charts/)). It is also possible to combine several representations in the same plot.
3939

40-
For example, the `plotly.express` function `px.histogram` can add a subplot with a different statistical representation than the histogram, given by the parameter `marginal`. [Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
40+
For example, the `plotly.express` function `px.histogram` can add a subplot with a different statistical representation than the histogram, given by the parameter `marginal`. [Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4141

4242
```python
4343
import plotly.express as px

Diff for: doc/python/dot-plots.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.1'
8+
format_version: "1.1"
99
jupytext_version: 1.1.1
1010
kernelspec:
1111
display_name: Python 3
@@ -35,11 +35,11 @@ jupyter:
3535

3636
#### Basic Dot Plot
3737

38-
Dot plots (also known as [Cleveland dot plots](https://en.wikipedia.org/wiki/Dot_plot_(statistics))) show changes between two (or more) points in time or between two (or more) conditions. Compared to a [bar chart](/python/bar-charts/), dot plots can be less cluttered and allow for an easier comparison between conditions.
38+
Dot plots (also known as [Cleveland dot plots](<https://en.wikipedia.org/wiki/Dot_plot_(statistics)>)) show changes between two (or more) points in time or between two (or more) conditions. Compared to a [bar chart](/python/bar-charts/), dot plots can be less cluttered and allow for an easier comparison between conditions.
3939

4040
For the same data, we show below how to create a dot plot using either `px.scatter` (for a tidy pandas DataFrame) or `go.Scatter`.
4141

42-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
42+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4343

4444
```python
4545
import plotly.express as px
@@ -158,5 +158,4 @@ fig.show()
158158

159159
### Reference
160160

161-
162161
See https://plot.ly/python/reference/#scatter for more information and chart attribute options!

Diff for: doc/python/error-bars.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jupyter:
3535

3636
### Error Bars with Plotly Express
3737

38-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/). For functions representing 2D data points such as [`px.scatter`](https://plot.ly/python/line-and-scatter/), [`px.line`](https://plot.ly/python/line-charts/), [`px.bar`](https://plot.ly/python/bar-charts/) etc., error bars are given as a column name which is the value of the `error_x` (for the error on x position) and `error_y` (for the error on y position).
38+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). For functions representing 2D data points such as [`px.scatter`](https://plot.ly/python/line-and-scatter/), [`px.line`](https://plot.ly/python/line-charts/), [`px.bar`](https://plot.ly/python/bar-charts/) etc., error bars are given as a column name which is the value of the `error_x` (for the error on x position) and `error_y` (for the error on y position).
3939

4040
```python
4141
import plotly.express as px

Diff for: doc/python/filled-area-plots.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ This example shows how to fill the area enclosed by traces.
3737

3838
## Filled area plot with plotly.express
3939

40-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
40+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4141

4242
`px.area` creates a stacked area plot. Each filled area corresponds to one value of the column given by the `line_group` parameter.
4343

Diff for: doc/python/funnel-charts.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: '1.2'
8+
format_version: "1.2"
99
jupytext_version: 1.3.0
1010
kernelspec:
1111
display_name: Python 3
@@ -24,23 +24,20 @@ jupyter:
2424
thumbnail: thumbnail/funnel.jpg
2525
---
2626

27-
2827
### Introduction
2928

3029
Funnel charts are often used to represent data in different stages of a business process. It’s an important mechanism in Business Intelligence to identify potential problem areas of a process. For example, it’s used to observe the revenue or loss in a sales process for each stage, and displays values that are decreasing progressively. Each stage is illustrated as a percentage of the total of all values.
3130

32-
3331
### Basic Funnel Plot with plotly.express
3432

35-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
33+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
3634

3735
With `px.funnel`, each row of the DataFrame is represented as a stage of the funnel.
3836

39-
4037
```python
4138
import plotly.express as px
4239
data = dict(
43-
number=[39, 27.4, 20.6, 11, 2],
40+
number=[39, 27.4, 20.6, 11, 2],
4441
stage=["Website visit", "Downloads", "Potential customers", "Requested price", "invoice sent"])
4542
fig = px.funnel(data, x='number', y='stage')
4643
fig.show()
@@ -76,6 +73,7 @@ fig.show()
7673
```
7774

7875
### Setting Marker Size and Color
76+
7977
This example uses [textposition](https://plot.ly/python/reference/#scatter-textposition) and [textinfo](https://plot.ly/python/reference/#funnel-textinfo) to determine information apears on the graph, and shows how to customize the bars.
8078

8179
```python
@@ -167,7 +165,6 @@ fig.show()
167165

168166
#### Multiple Area Funnels
169167

170-
171168
```python
172169
from plotly import graph_objects as go
173170

@@ -204,4 +201,5 @@ fig.show()
204201
```
205202

206203
#### Reference
204+
207205
See https://plot.ly/python/reference/#funnel and https://plot.ly/python/reference/#funnelarea for more information and chart attribute options!

Diff for: doc/python/histograms.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bar, go to the [Bar Chart tutorial](/python/bar-charts/).
4141

4242
## Histogram with Plotly Express
4343

44-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
44+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4545

4646
```python
4747
import plotly.express as px

Diff for: doc/python/horizontal-bar-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ See more examples of bar charts (including vertical bar charts) and styling opti
3737

3838
### Horizontal Bar Chart with Plotly Express
3939

40-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/). For a horizontal bar char, use the `px.bar` function with `orientation='h'`.
40+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). For a horizontal bar char, use the `px.bar` function with `orientation='h'`.
4141

4242
#### Basic Horizontal Bar Chart with Plotly Express
4343

Diff for: doc/python/line-and-scatter.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jupyter:
3636

3737
## Scatter plot with Plotly Express
3838

39-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
39+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4040

4141
With `px.scatter`, each data point is represented as a marker point, which location is given by the `x` and `y` columns.
4242

Diff for: doc/python/line-charts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jupyter:
3737

3838
### Line Plot with plotly.express
3939

40-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/). With `px.line`, each data point is represented as a vertex (which location is given by the `x` and `y` columns) of a **polyline mark** in 2D space.
40+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/). With `px.line`, each data point is represented as a vertex (which location is given by the `x` and `y` columns) of a **polyline mark** in 2D space.
4141

4242
For more examples of line plots, see the [line and scatter notebook](https://plot.ly/python/line-and-scatter/).
4343

Diff for: doc/python/linear-fits.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jupyter:
3737

3838
### Linear fit trendlines with Plotly Express
3939

40-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
40+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4141

4242
Plotly Express allows you to add [Ordinary Least](https://en.wikipedia.org/wiki/Ordinary_least_squares) Squares regression trendline to scatterplots with the `trendline` argument. In order to do so, you will need to install `statsmodels` and its dependencies. Hovering over the trendline will show the equation of the line and its R-squared value.
4343

Diff for: doc/python/lines-on-maps.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Plotly figures made with `px.scatter_geo`, `px.line_geo` or `px.choropleth` func
4141

4242
## Lines on Maps with Plotly Express
4343

44-
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/).
44+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on "tidy" data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
4545

4646
```python
4747
import plotly.express as px

0 commit comments

Comments
 (0)