Skip to content

Commit 803d441

Browse files
authored
Update box-plots.md
- There is no need for passing dummy variable `y` when stats have already been computed - `upperfence` values don't match the resulting figure. - It could be simplified even further by getting rid of the extra call to `add_trace` but I've kept it to follow the documentation styling. - It might be worth it to separate the example in two cases: (i) with only `q1`, `median`, `q3` provided, (ii) with all values provided.
1 parent 43ff7c1 commit 803d441

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

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

+3-9
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,10 @@ import plotly.graph_objects as go
233233

234234
fig = go.Figure()
235235

236-
fig.add_trace(go.Box(y=[
237-
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
238-
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
239-
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
240-
], name="Precompiled Quartiles"))
241-
242-
fig.update_traces(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ],
236+
fig.add_trace(go.Box(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ],
243237
q3=[ 7, 8, 9 ], lowerfence=[-1, 0, 1],
244-
upperfence=[5, 6, 7], mean=[ 2.2, 2.8, 3.2 ],
245-
sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ] )
238+
upperfence=[7, 8, 9], mean=[ 2.2, 2.8, 3.2 ],
239+
sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ], name="Precompiled Quartiles"))
246240

247241
fig.show()
248242
```

0 commit comments

Comments
 (0)