From 803d44164b31644987eb1b35cebe5bb8e6df0948 Mon Sep 17 00:00:00 2001 From: Vyom Patel <40802839+patelvyom@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:19:32 -0600 Subject: [PATCH] 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. --- doc/python/box-plots.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/python/box-plots.md b/doc/python/box-plots.md index a22762c0750..974774bb34e 100644 --- a/doc/python/box-plots.md +++ b/doc/python/box-plots.md @@ -233,16 +233,10 @@ import plotly.graph_objects as go fig = go.Figure() -fig.add_trace(go.Box(y=[ - [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], - [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], - [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ] - ], name="Precompiled Quartiles")) - -fig.update_traces(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ], +fig.add_trace(go.Box(q1=[ 1, 2, 3 ], median=[ 4, 5, 6 ], q3=[ 7, 8, 9 ], lowerfence=[-1, 0, 1], - upperfence=[5, 6, 7], mean=[ 2.2, 2.8, 3.2 ], - sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ] ) + upperfence=[7, 8, 9], mean=[ 2.2, 2.8, 3.2 ], + sd=[ 0.2, 0.4, 0.6 ], notchspan=[ 0.2, 0.4, 0.6 ], name="Precompiled Quartiles")) fig.show() ```