Bar plots

The following examples show how to use bar plots to visualize distributions or histograms.

Basic Examples

The following code shows the simplest usage of a bar plot. In this example, the bars will be drawn with a fixed graphical width according to the thickness property. This means that the bar width is independent of the x-axis range.

By specifying a width in the respective data property, you can use a fixed bar width with respect to the respective axis instead of the screen.

The following example demonstrates the difference: The width of the bars in the left graph is specified as thickness of the KontrastBars object. In the right graph, the width within the data property is specified. You'll see the difference clearly if you zoom in or out of the horizontal axis using the mouse wheel or a touch gesture.

Example with error bars

You can also add error bars to bar plots. Please refer to Example: Error bars for details.

Example with custom bin edges

By specifying the data property edge you can use bars with non-uniform widths.

Using a variable base value

You can change the start position of the bars by specifying the baseValue. The value can be either a number or a numeric array like in the following example:

Using a color axis

It may be useful to color the bars according to their value. For this you can utilize a color axis.