Skip to content

Box Plot

In descriptive statistics, a Box Plot is a method for graphically depicting groups of numerical data through their quartiles. Box Plots may also have lines extending vertically from the boxes (whiskers) indicating variability outside the upper and lower quartiles, hence the terms box-and-whisker plot and box-and-whisker diagram. Box Plots are non-parametric: they display variation in samples of a statistical population without making any assumptions of the underlying statistical distribution. The spacings between the different parts of the box indicate the degree of dispersion (spread) and skewness in the data.

Box Plot Elements: The following image shows the basic elements of the boxplot supported by the ChartFactor Toolkit.

BP

The following code shows how to create a simple Box Plot using the ChartFactor Toolkit:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
    // Define the metrics to be used
    var metrics = [];
    var metric = cf.Metric('commission', 'percentiles');

    // define attribute to group by
    var groups = [];
    var group = cf.Attribute('catname')
                    .limit(10)
                    .sort('desc', metric);

    metrics.push(metric);
    groups.push(group);

    var myChart = cf.provider('Elasticsearch')
                    .source('ticket_sales')
                    .groupby(...groups)
                    .metrics(...metrics)
                    .graph('Box Plot')
                    //.set('orientation', 'horizontal')
                    .element('chart');

Previous code will render a Box Plot like follow: BP