﻿ boxplot

# boxplot

(as of v1.8.7)

boxplot{
... ,

[name=DefaultName],

[title=""],

[fill={color=DefaultColor, style=DefaultStyle}],

[line={ color=DefaultColor, width=1, style=DefaultStyle}],

[hwnd=nil],

} → window handle (light userdata)

The functions returns the window handle of the plot window.

Note on Terminology: The word Default in the arguments is used to denote that the so-called value is assigned/computed by the system until a new value is assigned.

Arguments:

 ... : Any number of variable ← Vector name: Name of the series ← string title: Title of the chart ← string Fill Properties color: In the form of “R G B” ← string style: By default it is solid (=100, see std.const.fillstyle). ← integer Line Properties width: width of the line ← integer color: color of the line, in the form of "R G B" ← string style: By default it is solid (=100, see std.const.linestyle). ← integer hwnd: The handle of a window. If nil then the chart is displayed on a new plot window ← Light userdata

## EXAMPLES

Let's start from simple to advanced use of the boxplot command and let's stick to the same x and y vectors (arbitrarily chosen) and declare them beforehand.

>>x=std.tovector{2, 1, 3, 6, 4}
>>y=std.tovector{7, 7, 8, 4, 2}

### A) Only data is provided

This is the simplest use of the command. Two vectors, namely x and y are provided.

>>std.boxplot{x, y} -- lets omit the returned windowID

The name of the series are automatically assigned as "Series 1" and "Series 2" and since neither fill nor line is defined, the system assigned the computed values.

### B) Defining fill properties

If we define the fill properties, they will be applied to the any number of vectors we define. For example:

>>std.boxplot{x, y, fill = {color = "0 0 255"} }

Here, it is clearly seen that both series have the same fill color, since the fill color has been explicitly defined in the command. There are a few choices to overcome this situation:

1. Only defining the style and letting the system assign colors.
2. Letting system assign line properties, thus the boundaries of the box will have different colors.
3. For precise control, using the hwnd property and running the boxplot command twice.

Let's demonstrate the last case:

--Let's define some styles
>>solid=std.const.fillstyle.solid
>>dhatch=std.const.fillstyle.fdiaghatch

>>hwnd = std.boxplot{x, fill = {color="0 255 255", style=solid} }
>>std.boxplot{y, fill = {color="0 0 255", style=dhatch}, hwnd=hwnd}

Please note that, the above-mentioned rationale also applies to name property as well, such that if we define the name, it will be applied to all of the defined vectors.

### C) Defining line properties

Similar to fill properties, if we define the line properties, they will be applied to the any number of vectors we define. For example, the following commands produces a chart with fill color and style automatically assigned whereas line styles are custom defined.

>>solid=std.const.linestyle.solid
>>std.boxplot{x, line = {color="0 255 0", style=solid, width=3} }