[deutsch]

Bars

Bars can be used to visualize histograms of data or other discrete distributions as bar plots.

Data input

Normal mode

Each bar starts at the baseValue (which is often zero) and reaches up to a certain value. To position the bar on an axis, you can specify it's center position with value along with an optional width.

In the following code snippets, we will assume that there is an abscissa named x and an ordinate named y.

Alternatively, you can specify the edge (i.e. the bin limits):

Several examples can be found at Example: Bar plots.

Adaptive histogram mode

Instead of the above data configuration, you can also supply an array of numbers to the Bars data object and Kontrast will compute an adaptive histogram of the data based on the current axis limits and axis mapping.

The following code creates an adaptive histogram of the distribution of numbers within the array xArray.

This shows how the adaptive histogram works. The 20 values are randomly generated and are shown as red points. (The vertical positions of the points have no meaning; they are just used to avoid overlapping the points.)

If you zoom or shift the vertical axis (using Ctrl + Scroll, for example), you'll see that the visible bin-width (i.e., the bin size on the screen) and the positions of the bars are unchanged and the height of the bars are dynamically changed.

Several examples can be found at Example: Adaptive bar histograms.

Interface

Please also refer to the documentation for all plot objects.

Properties

Examples