fplot Manual

\(\newcommand{\footnotename}{footnote}\) \(\def \LWRfootnote {1}\) \(\newcommand {\footnote }[2][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\newcommand {\footnotemark }[1][\LWRfootnote ]{{}^{\mathrm {#1}}}\) \(\let \LWRorighspace \hspace \) \(\renewcommand {\hspace }{\ifstar \LWRorighspace \LWRorighspace }\) \(\newcommand {\TextOrMath }[2]{#2}\) \(\newcommand {\mathnormal }[1]{{#1}}\) \(\newcommand \ensuremath [1]{#1}\) \(\newcommand {\LWRframebox }[2][]{\fbox {#2}} \newcommand {\framebox }[1][]{\LWRframebox } \) \(\newcommand {\setlength }[2]{}\) \(\newcommand {\addtolength }[2]{}\) \(\newcommand {\setcounter }[2]{}\) \(\newcommand {\addtocounter }[2]{}\) \(\newcommand {\arabic }[1]{}\) \(\newcommand {\number }[1]{}\) \(\newcommand {\noalign }[1]{\text {#1}\notag \\}\) \(\newcommand {\cline }[1]{}\) \(\newcommand {\directlua }[1]{\text {(directlua)}}\) \(\newcommand {\luatexdirectlua }[1]{\text {(directlua)}}\) \(\newcommand {\protect }{}\) \(\def \LWRabsorbnumber #1 {}\) \(\def \LWRabsorbquotenumber "#1 {}\) \(\newcommand {\LWRabsorboption }[1][]{}\) \(\newcommand {\LWRabsorbtwooptions }[1][]{\LWRabsorboption }\) \(\def \mathchar {\ifnextchar "\LWRabsorbquotenumber \LWRabsorbnumber }\) \(\def \mathcode #1={\mathchar }\) \(\let \delcode \mathcode \) \(\let \delimiter \mathchar \) \(\def \oe {\unicode {x0153}}\) \(\def \OE {\unicode {x0152}}\) \(\def \ae {\unicode {x00E6}}\) \(\def \AE {\unicode {x00C6}}\) \(\def \aa {\unicode {x00E5}}\) \(\def \AA {\unicode {x00C5}}\) \(\def \o {\unicode {x00F8}}\) \(\def \O {\unicode {x00D8}}\) \(\def \l {\unicode {x0142}}\) \(\def \L {\unicode {x0141}}\) \(\def \ss {\unicode {x00DF}}\) \(\def \SS {\unicode {x1E9E}}\) \(\def \dag {\unicode {x2020}}\) \(\def \ddag {\unicode {x2021}}\) \(\def \P {\unicode {x00B6}}\) \(\def \copyright {\unicode {x00A9}}\) \(\def \pounds {\unicode {x00A3}}\) \(\let \LWRref \ref \) \(\renewcommand {\ref }{\ifstar \LWRref \LWRref }\) \( \newcommand {\multicolumn }[3]{#3}\) \(\require {textcomp}\) \(\newcommand {\intertext }[1]{\text {#1}\notag \\}\) \(\let \Hat \hat \) \(\let \Check \check \) \(\let \Tilde \tilde \) \(\let \Acute \acute \) \(\let \Grave \grave \) \(\let \Dot \dot \) \(\let \Ddot \ddot \) \(\let \Breve \breve \) \(\let \Bar \bar \) \(\let \Vec \vec \) \(\newcommand {\toprule }[1][]{\hline }\) \(\let \midrule \toprule \) \(\let \bottomrule \toprule \) \(\def \LWRbooktabscmidruleparen (#1)#2{}\) \(\newcommand {\LWRbooktabscmidrulenoparen }[1]{}\) \(\newcommand {\cmidrule }[1][]{\ifnextchar (\LWRbooktabscmidruleparen \LWRbooktabscmidrulenoparen }\) \(\newcommand {\morecmidrules }{}\) \(\newcommand {\specialrule }[3]{\hline }\) \(\newcommand {\addlinespace }[1][]{}\) \(\newcommand {\tcbset }[1]{}\) \(\newcommand {\tcbsetforeverylayer }[1]{}\) \(\newcommand {\tcbox }[2][]{\boxed {\text {#2}}}\) \(\newcommand {\tcboxfit }[2][]{\boxed {#2}}\) \(\newcommand {\tcblower }{}\) \(\newcommand {\tcbline }{}\) \(\newcommand {\tcbtitle }{}\) \(\newcommand {\tcbsubtitle [2][]{\mathrm {#2}}}\) \(\newcommand {\tcboxmath }[2][]{\boxed {#2}}\) \(\newcommand {\tcbhighmath }[2][]{\boxed {#2}}\)

4 Configuration Options

The :options table in fplot controls the overall appearance and properties of your plot. It’s where you set titles, labels, ranges, output files, and more.

Below is a comprehensive list of all available options. Remember that when using Lua, keys with hyphens (like :output-file) must be written using the ["key-name"] = value syntax.

4.1 General
.
Key Type

Description

Example (Fennel)

:title string

The main title of the plot.

:title "My Awesome Plot"

:output-type string

The gnuplot terminal to use. Determines the output format. Common values: wxt (default, interactive window), qt, pngcairo, svg, pdfcairo.

:output-type "pngcairo"

:output-file string

The path to save the output file. If nil, the plot is displayed in an interactive window.

:output-file "my-plot.png"

:size table

A table [width, height] specifying the dimensions of the output in pixels.

:size [800 600]

:font string

The font to use for text elements (e.g., ”Arial”, ”Helvetica”).

:font "Arial"

:font-size number

The size of the font.

:font-size 12

:gnuplot-executable string

The path to the gnuplot executable. Defaults to "gnuplot", relying on the system PATH.

:gnuplot-executable "/opt/local/bin/gnuplot"

4.2 Axes and Labels
.
Key Type

Description

Example (Fennel)

:x-label string

The label for the x-axis.

:x-label "Time (s)"

:y-label string

The label for the y-axis.

:y-label "Velocity (m/s)"

:z-label string

The label for the z-axis (for 3D plots).

:z-label "Height (m)"

:x-range table

A table [min, max] for the x-axis range. Use "*" for auto-scaling one end.

:x-range [-10 10]

:y-range table

A table [min, max] for the y-axis range.

:y-range [0 "*"]

:z-range table

A table [min, max] for the z-axis range.

:z-range [-2 2]

:log-scale string

A string specifying which axes should use a logarithmic scale (e.g., "x", "xy", "z").

:log-scale "y"

4.3 Tics
.
Key Type

Description

Example (Fennel)

:tics table

A map to control global tic settings for axes.

:tics {:xtics "mirror", :ytics "rotate by 90"}

:xtics table

Sets custom tic marks for the x-axis. Can be a simple list of values or a list of [label, value] pairs.

:xtics [["Low" 0] ["Mid" 50] ["High" 100]]

:ytics table

Sets custom tic marks for the y-axis.

:ytics [0 10 20 30]

4.4 Appearance
.
Key Type

Description

Example (Fennel)

:grid boolean

If true, displays a grid on the plot.

:grid true

:border boolean

If true (default), displays a border around the plot.

:border false

:key table

Controls the plot’s key (legend). Set :enabled false to hide it.

:key {:enabled true :position "bottom left"}

:palette string

Sets the color palette for 3D plots or color-mapped data.

:palette "defined (0 'blue', 1 'green', 2 'red')"

4.5 Advanced
.
Key Type

Description

Example (Fennel)

:labels list

A list of tables [text, x, y, options] to place text labels on the plot.

:labels [["Peak" 1.5 9.8 "center font 'Verdana,10'"]]

:arrows list

A list of tables [x1, y1, x2, y2, options] to draw arrows.

:arrows [[0 0 1.5 9.8 "head filled"]]

:objects list

A list of tables [type, definition] to draw geometric shapes.

:objects [["rectangle" "from 0,0 to 1,1 fc rgb 'blue'"]]

:multiplot table

A table to configure a multiplot layout.

:multiplot {:layout [2 2] :title "My Multiplot"}

:extra-opts list

A list of raw gnuplot commands to be inserted into the script.

:extra-opts ["set style data histograms" "set style fill solid"]

For options specific to individual datasets (like line color and style), see the Dataset Configuration section.