The examples in the box plot documentation https://plot.ly/python/box-plots/ can be translated to Dash as:
import plotly.graph_objs as go
import numpy as np
y0 = np.random.randn(50)-1
y1 = np.random.randn(50)+1
trace0 = go.Box(
y=y0
)
trace1 = go.Box(
y=y1
)
data = [trace0, trace1]
dcc.Graph(figure={'data': data}, id='box-plot-1')
import plotly.graph_objs as go
trace0 = go.Box(
y = [0.75, 5.25, 5.5, 6, 6.2, 6.6, 6.80, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15,
8.15, 8.65, 8.93, 9.2, 9.5, 10, 10.25, 11.5, 12, 16, 20.90, 22.3, 23.25],
name = "All Points",
jitter = 0.3,
pointpos = -1.8,
boxpoints = 'all',
marker = dict(
color = 'rgb(7,40,89)'),
line = dict(
color = 'rgb(7,40,89)')
)
trace1 = go.Box(
y = [0.75, 5.25, 5.5, 6, 6.2, 6.6, 6.80, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15,
8.15, 8.65, 8.93, 9.2, 9.5, 10, 10.25, 11.5, 12, 16, 20.90, 22.3, 23.25],
name = "Only Whiskers",
boxpoints = False,
marker = dict(
color = 'rgb(9,56,125)'),
line = dict(
color = 'rgb(9,56,125)')
)
trace2 = go.Box(
y = [0.75, 5.25, 5.5, 6, 6.2, 6.6, 6.80, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15,
8.15, 8.65, 8.93, 9.2, 9.5, 10, 10.25, 11.5, 12, 16, 20.90, 22.3, 23.25],
name = "Suspected Outliers",
boxpoints = 'suspectedoutliers',
marker = dict(
color = 'rgb(8,81,156)',
outliercolor = 'rgba(219, 64, 82, 0.6)',
line = dict(
outliercolor = 'rgba(219, 64, 82, 0.6)',
outlierwidth = 2)),
line = dict(
color = 'rgb(8,81,156)')
)
trace3 = go.Box(
y = [0.75, 5.25, 5.5, 6, 6.2, 6.6, 6.80, 7.0, 7.2, 7.5, 7.5, 7.75, 8.15,
8.15, 8.65, 8.93, 9.2, 9.5, 10, 10.25, 11.5, 12, 16, 20.90, 22.3, 23.25],
name = "Whiskers and Outliers",
boxpoints = 'outliers',
marker = dict(
color = 'rgb(107,174,214)'),
line = dict(
color = 'rgb(107,174,214)')
)
data = [trace0,trace1,trace2,trace3]
layout = go.Layout(
title = "Box Plot Styling Outliers"
)
fig = go.Figure(data=data,layout=layout)
dcc.Graph(figure=fig, id='box-plot-2')