Skip to content

Commit eeb774d

Browse files
box plot tweaks
1 parent df66a2c commit eeb774d

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

doc/python/box-plots.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ jupyter:
55
text_representation:
66
extension: .md
77
format_name: markdown
8-
format_version: "1.1"
9-
jupytext_version: 1.1.1
8+
format_version: '1.2'
9+
jupytext_version: 1.3.1
1010
kernelspec:
1111
display_name: Python 3
1212
language: python
@@ -30,10 +30,10 @@ jupyter:
3030
order: 2
3131
page_type: example_index
3232
permalink: python/box-plots/
33-
thumbnail: thumbnail/box.jpg
3433
redirect_from:
35-
- /python/box/
36-
- /python/basic_statistics/
34+
- /python/box/
35+
- /python/basic_statistics/
36+
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/).
@@ -106,12 +106,12 @@ df = pd.DataFrame(dict(
106106
)).melt(var_name="quartilemethod")
107107

108108

109-
fig = px.box(df, y="value",
110-
facet_col="quartilemethod", boxmode="overlay", color="quartilemethod")
109+
fig = px.box(df, y="value", facet_col="quartilemethod", color="quartilemethod",
110+
boxmode="overlay", points='all')
111111

112-
fig.update_traces(quartilemethod="linear", col=1)
113-
fig.update_traces(quartilemethod="inclusive", col=2)
114-
fig.update_traces(quartilemethod="exclusive", col=3)
112+
fig.update_traces(quartilemethod="linear", jitter=0, col=1)
113+
fig.update_traces(quartilemethod="inclusive", jitter=0, col=2)
114+
fig.update_traces(quartilemethod="exclusive", jitter=0, col=3)
115115

116116
fig.show()
117117
```
@@ -196,6 +196,7 @@ fig = go.Figure()
196196
fig.add_trace(go.Box(y=data, quartilemethod="linear", name="Linear Quartile Mode"))
197197
fig.add_trace(go.Box(y=data, quartilemethod="inclusive", name="Inclusive Quartile Mode"))
198198
fig.add_trace(go.Box(y=data, quartilemethod="exclusive", name="Exclusive Quartile Mode"))
199+
fig.update_traces(boxpoints='all', jitter=0)
199200
fig.show()
200201
```
201202

0 commit comments

Comments
 (0)