Element: plot/bars

The plot/bars element is used to create bar charts.

Syntax

(plot/bars <options>)

Example

Options

Bar Options

data-x data-x-high data-x-low data-y data-y-high data-y-low color direction bar-width bar-offset bar-stroke-color bar-stroke-width bar-stroke-style bar-fill

Label Options

labels label-font-size label-color label-padding

Scale Options

limit-x limit-x-min limit-x-max limit-y limit-y-min limit-y-max scale-x scale-y scale-x-padding scale-y-padding

Bar Options

data-x

Set the 'x' dataset for the plot. The 'x' dataset will be used to calculate the horizontal position of geometry.

data-x (<values>...)
data-x (csv <file> <column>)
Examples:
;; list of static values
data-x (10px 20px 30px)

;; load a csv file
data-x (csv myfile.csv mycolumn)

data-x-high

Alias for the data-x option.

data-x-low

Set the 'x2' dataset for the plot. The 'x2' dataset will be used to calculate the horizontal position of geometry.

data-x-low (<values>...)
data-x-low (csv <file> <column>)
Examples:
;; list of static values
data-x-low (10px 20px 30px)

;; load a csv file
data-x-low (csv myfile.csv mycolumn)

data-y

Set the 'y' dataset for the plot. The 'y' dataset will be used to calculate the vertical position of geometry.

data-y (<values>...)
data-y (csv <file> <column>)
Examples:
;; list of static values
data-y (10px 20px 30px)

;; load a csv file
data-y (csv myfile.csv mycolumn)

data-y-high

Alias for the data-y option.

data-y-low

Set the 'y2' dataset for the plot. The 'y2' dataset will be used to calculate the vertical position of geometry.

data-y-low (<values>...)
data-y-low (csv <file> <column>)
Examples:
;; list of static values
data-y-low (10px 20px 30px)

;; load a csv file
data-y-low (csv myfile.csv mycolumn)

color

Set the bar color.

color <color>

direction

Set the bar 'direction'.

direction [horizontal|vertical]
Examples:
;; draw a vertical "bar" chart
direction vertical

;; draw a horizontal "column" chart
direction horizontal

bar-width

Set the bar width. See the measure page for more details on valid values.

bar-width <measure>
Examples:
;; set the bar width to 1em
bar-width 1em

bar-offset

Set the bar offset. See the measure page for more details on valid values.

bar-offset <measure>
Examples:
;; set the bar offset to -.4em
bar-offset -.4em

bar-stroke-color

Set the bar's stroke color. See the color page for more details on valid values.

bar-stroke-color <color>
Examples:
;; set the stroke color to grey
bar-stroke-color #eee

bar-stroke-width

Set the bar stroke width. See the measure page for more details on valid values.

bar-stroke-width <measure>
Examples:
;; set the bar stroke width to 2pt
bar-stroke-width 2pt

bar-stroke-style

Set the bar stroke style. See the Fill & Stroke Styles page for more details on valid values.

bar-stroke-style <stroke-style>
Examples:
;; set the bar stroke style to none
bar-stroke-style solid

bar-fill

Set the bar fill. See the Fill & Stroke Styles page for more details on valid values.

bar-fill <fil-style>
Examples:
;; set the bar fill to blue
bar-fill #00f

Label Options

labels

Set the labels for the plot. If set, a label will be drawn for each bar in the dataset at the bar's (x, y) coordinate,

label-format (<values>...)
labels (csv <file> <column>)
Examples:
;; list of static values
label-format ("A" "B" "C")

;; load a csv file
labels (csv myfile.csv mylabels)

label-font-size

Set the label font size. See the measure page for more details on valid values.

label-font-size <measure>
Examples:
;; set the label font size to 14pt
label-font-size 14pt

label-color

Set the label color. See the color page for more details on valid values.

label-color <color>
Examples:
;; set the label color to grey
label-color #eee

label-padding

Set the label padding/spacing. See the measure page for more details on valid values.

label-padding <measure>
Examples:
;; set the label padding to 2em
label-padding 2em

Scale Options

limit-x

Set the 'x' axis value range to the closed interval [min, max]. If no explicit limits are specified, the limit is set to the smallest interval that contains all input data points.

limit-x (<min> <max)
Examples:
;; set x axis range to [1..10]
limit-x (1 10)

limit-x-min

Set the 'x' axis minimum value. If no explicit minimum is specified, the minimum is set to the smallest value in the input data set.

limit-x-min <min>
Examples:
;; set x axis min value to 2
limit-x-min 2

limit-x-max

Set the 'x' axis maximum value. If no explicit maximm is specified, the maximum is set to the largest value in the input data set.

limit-x-max <max>
Examples:
;; set x axis max value to 20
limit-x-max 20

limit-y

Set the 'y' axis value range to the closed interval [min, max]. If no explicit limits are specified, the limit is set to the smallest interval that contains all input data points.

limit-y (<min> <max)
Examples:
;; set y axis range to [1..10]
limit-y (1 10)

limit-y-min

Set the 'y' axis minimum value. If no explicit minimum is specified, the minimum is set to the smallest value in the input data set.

limit-y-min <min>
Examples:
;; set y axis min value to 2
limit-y-min 2

limit-y-max

Set the 'y' axis maximum value. If no explicit maximm is specified, the maximum is set to the largest value in the input data set.

limit-y-max <max>
Examples:
;; set y axis max value to 20
limit-y-max 20

scale-x

Set the 'x' scale type.

scale-x ([linear] [log] [logarithmic] [invert] [inverted])

List of scale types:

  • linear - Standard linear scale
  • log, logarithmic - Logarithmic (log10) scale
  • invert, inverted - Flip the scale
Examples:
;; set x axis to logarithmic mode
scale-x (log)

;; set x axis to inverted mode
scale-x (invert)

scale-y

Set the 'y' scale type.

scale-y ([linear] [log] [logarithmic] [invert] [inverted])

List of scale types:

  • linear - Standard linear scale
  • log, logarithmic - Logarithmic (log10) scale
  • invert, inverted - Flip the scale
Examples:
;; set x axis to logarithmic mode
scale-y (log)

;; set x axis to inverted mode
scale-y (invert)

scale-x-padding

Set the 'x' scale 'padding'. The scale padding is used to extend the automatically assigned scale limits. The padding option is hence only useful when no explicit limits are specified (using limit-x). The padding is specified in the display unit system of the axis.

scale-x-padding <value>
Examples:
;; set x axis padding to 10
scale-x-padding 10

scale-y-padding

Set the 'y' scale 'padding'. The scale padding is used to extend the automatically assigned scale limits. The padding option is hence only useful when no explicit limits are specified (using limit-y). The padding is specified in the display unit system of the axis.

scale-y-padding <value>
Examples:
;; set y axis padding to 10
scale-y-padding 10
Edit this page on GitHub