src/nimgnuplot

Search:
Group by:

Types

GnuplotScript = object
GnuplotScript is a stateful object. Data, command, and plot procs are called to accumulate a script. Execute proc sends the script to gnuplot via exec.

Procs

proc addData(self: var GnuplotScript; dataLabel: string; dataCsv: string;
             separator: char = ','): seq[string] {....raises: [IOError, OSError],
    tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Add data in the form of a CSV string. Provide the correct separator to properly inform gnuplot of the data's format.
proc addData(self: var GnuplotScript; dataLabel: string; dataframe: DataFrame;
             separator: char = ','): seq[string] {.
    ...raises: [ValueError, KeyError, IOError, OSError],
    tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Add a single dataframe to the gnuplot script. Returns the column headers in order.
proc addData(self: var GnuplotScript; dataLabel: string;
             dataframes: seq[DataFrame]; separator: char = ','): seq[string] {.
    ...raises: [ValueError, KeyError, IOError, OSError],
    tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Laterally concatenate dataframes of different lengths into a single CSV and add to the gnuplot script. Returns the column headers in order.
proc addData[T](self: var GnuplotScript; dataLabel: string; data: T;
                separator: char = ','): seq[string]
Generic addData[T](). To work, simply define toCsvString() for your arbitrary tabular data type.
proc addDataIndexed(self: var GnuplotScript; dataLabelPrefix: string;
                    dataframes: seq[DataFrame]; separator: char = ','): seq[
    seq[string]] {....raises: [ValueError, KeyError, IOError, OSError],
                   tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
Add multiple dataframes to the gnuplot script, with the same label but appended with an index. Returns each dataframe's column headers in order, each in a seq.
proc cmd(self: var GnuplotScript; commands: string): void {....raises: [],
    tags: [], forbids: [].}
Add a single command, or a multiline series of commands to the script.
proc escapeEnhanced(input: string): string {....raises: [], tags: [], forbids: [].}
For enhanced mode text, escape all enhancement control characters
proc execute(self: var GnuplotScript): string {....raises: [IOError, OSError], tags: [
    TimeEffect, WriteIOEffect, ReadEnvEffect, ReadIOEffect, ExecIOEffect,
    RootEffect, WriteDirEffect], forbids: [].}
Execute the accumulated gnuplot script. Saves the generated image plot to a temp file, and returns the temp file's contents as a byte string.
proc gdo(self: var GnuplotScript; iteration: string; commands: seq[string]) {.
    ...raises: [], tags: [], forbids: [].}
Add a gnuplot iteration block with arbitrary commands.
proc initGnuplotScript(script: seq[string] = @["set encoding utf8"];
                       printScript: bool = false; saveScript: bool = false): GnuplotScript {.
    ...raises: [], tags: [], forbids: [].}
Initialize a stateful gnuplot object which can take commands and eventually execute the gnuplot exe to generate a plot file.
proc plot(self: var GnuplotScript; plotElement: string; plotCmd: string = "plot") {.
    ...raises: [], tags: [], forbids: [].}
Plot a single element.
proc plot(self: var GnuplotScript; plotElements: seq[string];
          plotCmd: string = "plot") {....raises: [], tags: [], forbids: [].}
Plot multiple elements.
proc plotData(self: var GnuplotScript; dataLabel: string; plotElement: string;
              plotCmd: string = "plot") {....raises: [], tags: [], forbids: [].}
Generate a plot with one element from one data label.
proc plotData(self: var GnuplotScript; dataLabel: string;
              plotElements: seq[string]; plotCmd: string = "plot") {....raises: [],
    tags: [], forbids: [].}
Generate a plot with multiple elements from one data label.
proc plotData(self: var GnuplotScript;
              dataLabelsElements: seq[(string, string)];
              plotCmd: string = "plot") {....raises: [], tags: [], forbids: [].}
Generate a plot with multiple elements, each from its own data label.
proc toCsvString(dataframe: DataFrame; separator: char = ',';
                 precision: int = 10): string {....raises: [ValueError, KeyError],
    tags: [], forbids: [].}
Convert a dataframe into a CSV string.
proc toCsvString(dataframes: seq[DataFrame]; separator: char = ',';
                 precision: int = 10): string {....raises: [ValueError, KeyError],
    tags: [], forbids: [].}
Laterally concatenate multiple dataframes of different lengths into a single CSV string.
proc toCsvString(dataframesTable: Table[string, DataFrame];
                 separator: char = ','; precision: int = 10): string {.
    ...raises: [ValueError, KeyError], tags: [], forbids: [].}
Laterally concatenate a table of multiple dataframes into a single CSV string, using each dataframe's table key as a column prefix.