View on

Element: plot/axis

The plot/axis element is used to draw a labelled 'axis'.

Syntax

(plot/axis <options>)

Options

Layout Options

align

Label Options

label-placement label-format label-attach label-offset label-padding label-rotate label-font-size label-color

Tick Options

tick-placement tick-offset tick-length

Scale Options

limit limit-min limit-max scale scale-padding

Title Options

title title-offset title-padding title-rotate title-font-size title-color

Border Options

border border-width border-color

Layout Options

align

Controls where the axis is drawn.

align [x|y|top|right|bottom|left]
Examples:
;; align the axis to the right border
align right

;; draw a horizontal axis
align x

Label Options

label-placement

The 'label-placement' option controls the axis label placement.

label-placement <label-placement>
Examples:
;; subdivide the axis with 10 label-placement

label-format

The 'labels' option controls how axis labels are formatted.

labels <labels>
Examples:
;; use scientific labels for the top/bottom axes
label-format (scientific)

label-attach

Controls how labels are attached to the axis. Useful in conjunction with the label-rotate option.

label-attach [top|right|bottom|left]
Examples:
;; set label attach to left
label-attach left

label-offset

Controls to which side of the axis the labels are placed. Value is clamped to [-1, 1].

label-offset <value>
Examples:
;; center the labels
label-offset 0

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

label-rotate

Rotate the labels. Value is in degrees clockwise.

label-rotate <value>
Examples:
;; rotate the label by 45deg clockwise
label-rotate 45

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

Tick Options

tick-placement

The 'tick-placement' option controls where on the axis the "ticks" are placed.

tick-placement <tick-placement>
Examples:
;; subdivide the axis into 10 parts

tick-offset

Controls to which side of the axis the ticks are drawn. Value is clamped to [-1, 1].

tick-offset <value>
Examples:
;; center the ticks
ticks-offset 0

tick-length

Controls the length of the ticks

tick-length <measure>
Examples:
;; set tick length to 1em
ticks-length 1em

Scale Options

limit

Set the axis value range to the closed interval [min, max]. If no explicit maximm is specified, the default interval is [0.0, 1.0].

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

limit-min

Set the axis minimum value. If no explicit maximm is specified, the default maximum value is '0.0'.

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

limit-max

Set the axis maximum value. If no explicit maximm is specified, the default maximum value is '1.0'.

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

scale

Set the scale type.

scale ([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 the axis to logarithmic mode
scale (log)

;; set the axis to inverted mode
scale (invert)

scale-padding

Set the scale padding. Value is clamped to [0.0, 1.0]

scale-padding <value>
Examples:
;; set the scale padding to 0.5
scale-padding 0.5

Title Options

title

Set the axis title

title <title>
Examples:
;; set the axis title to "Time"
title "Time"

title-offset

Controls to which side of the axis the title is placed. Value is clamped to [-1, 1].

title-offset <value>
Examples:
;; center the title
title-offset 0

title-padding

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

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

title-rotate

Rotate the title. Value is in degrees clockwise.

title-rotate <value>
Examples:
;; rotate the title by 45deg clockwise
title-rotate 45

title-font-size

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

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

title-color

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

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

Border Options

border

Set the element's border stroke style. See the stroke-style page for more details on valid values.

border (<stroke-style>)
Examples:
;; set the border stroke to 2px solid
border (2px solid)

border-width

Set the element's border width. See the measure page for more details on valid values.

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

border-color

Set the element's border color. See the color page for more details on valid values.

border-color <color>
Examples:
;; set the border color to #333
border-color #333
Edit this page on GitHub