Skip to main content

Bar chart

As opposed to histograms, bar charts are helpful for displaying discrete data, as well as categorical data.

Syntax

bar_chart(Statistics_data)

Description

It draws a bar chart for a data sample.

graphics.bar_chart.calc.png
graphics.bar_chart.plotter.calc.png

Options

Option

Description

Format

Default value

bar_width

Specifies the width of bars to be used. If bars are stacked, it changes the width of the stacks, and if they are juxtaposed, then the total width of each juxtaposed set of bars is affected. If bar_width exceeds space_between_bars, the result is simply adjacent bars across the whole graph.

Positive Float.

1

beside

Only used when data is a matrix or list of lists. If set to true, bars will be juxtaposed. If false, bars are stacked.

Boolean.

false

color

Sets the color for the borders of the bars.

RGB list of values {r,g,b} where r, g, and b are integers between 0-255. Alternatively, one of the following strings: black, white, red, green, blue, cyan, magenta, yellow, brown, orange, pink, grey, dark_grey, light_grey, or one of the HTML colors, by name (e.g. html_indigo rather than 4b0082).

{66,66,66}

fill_color

Sets the color for the interior of the bars. For bar charts with a vector argument (single bars), consequent bars are colored according to the list order and wrapped around if fewer colors than bars are provided. For matrix arguments, the list specifies the order in which bars in a single stack or set of juxtaposed bars is colored (with the same wrap-around behaviour).

A list of colors {color1,color2,...} where each color follows the format described in the color option.

auto (a predetermined color scheme)

labels

Each element in the list makes a label appear below the corresponding (set of) bars. If fewer labels than bars are provided, then bars after the last label remain unlabeled.

A list of Strings {label1,label2,...}.

{} (empty list)

log_scale

When set to true, a logarithmic scale is used for the y-values of the chart.

Boolean.

false

orientation

When set to vertical, bars are placed vertically. When set to horizontal, bars are placed horizontally.

vertical or horizontal

vertical

show_axis

When set to true, the y-axis is shown on the graph if bars are plotted vertically. If bars are plotted horizontally, then the x-axis will be shown. If false, no axes are shown.

Boolean.

true

space_between_bars

Specifies the horizontal or vertical distance between bars (measured on the axes; scaling will adjust how much distance is actually seen, so we may need to adjust axes limits accordingly).

Positive Float

0.2

title

Displays a title above the graph.

String

"" (empty string)

x_limits

List of two numbers to be used as the minimum and maximum values displayed on the x-axis.

Two Floats {a,b}

{}