BoxPlot¶
A boxplot. The visualization takes a set of measures (fields) and produces a boxplot of each one. The optional group field will partition the data into groups with matching value and make a boxplot (or set of boxplots) for each group.
This component can be found in the candela/plugins/vega
plugin.
Example¶
JavaScript
<body>
<script src="//unpkg.com/candela/dist/candela.min.js"></script>
<script>
var el = document.createElement('div')
document.body.appendChild(el);
var data = [];
for (var d = 0; d < 10; d += 1) {
data.push({
a: d,
b: d/2 + 7
});
}
var vis = new candela.components.BoxPlot(el, {
data: data,
fields: ['a', 'b']
});
vis.render();
</script>
</body>
Python
import pycandela
data = [{'a': d, 'b': d/2 + 7} for d in range(10)]
pycandela.components.BoxPlot(data=data, fields=['a', 'b'])
R
library(candela)
candela('BoxPlot', data=mtcars, fields=c('mpg', 'wt', 'disp'))
Options¶
- data (Table)
- The data table.
- fields (Array of String)
- The fields to use as measurements. The visualization will produce a boxplot for each field. Must contain numeric or temporal data. See Axis scales. Axis type will be chosen by the inferred value of the first field in the array.
- x (String)
- The optional field to group by. Defaults to all records being placed in a single group. See Axis scales.
- xType (String)
- The data type for the
x
field. The default is"nominal"
. - color (String)
- The field used to color the box plots.
- colorType (String)
- The data type for the
color
field. The default is"nominal"
. - width (Number)
- Width of the chart in pixels. See Sizing.
- height (Number)
- Height of the chart in pixels. See Sizing.
- renderer (String)
- Whether to render in
"svg"
or"canvas"
mode (default"canvas"
).