The plots module contains some utilities for plotting graphs and images.
Procs
proc gridLayout(rows = 1; cols = 1; ytitle: openArray[string] = []; xtitle: openArray[string] = []): JsonNode {....raises: [KeyError], tags: [], forbids: [].}
- Create plotly layout for grid of plots with optional labels for each axis. Source Edit
proc openWebSocket(): WebSocket {....raises: [OSError, ValueError, IOError, Exception, ValueError, OSError, ValueError, Exception], tags: [ReadIOEffect, ExecIOEffect, RootEffect, ReadEnvEffect, TimeEffect], forbids: [].}
- Blocking open to get client websocket. Will start nimxla_plot server in the background if not already running. Source Edit
proc plotImageGrid(title: string; rows, cols: int; getData: proc (): (Tensor[uint8], seq[string], seq[bool])): ( JsonNode, JsonNode) {....raises: [Exception, ValueError, KeyError], tags: [RootEffect], forbids: [].}
- Plot grid of images and returns data and loyout Json objects for input to plotly. getData callBack function recieves should return a [N,H,W,C] 4d tensor with the images for this page - i.e. t.at(row*cols + col) returns a [H,W,C] grayscale (C=0) or RGB (C=0,1,2) image. and an optional sequence of labels for each image indexed in the same way. Source Edit
proc servePlots(): owned(Future[void]) {....stackTrace: false, raises: [Exception], tags: [ RootEffect, ExecIOEffect, ReadEnvEffect, TimeEffect, WriteIOEffect, ReadIOEffect], forbids: [].}
- Start async http server, serve plot using plotly on localhost and open the default browser on this page. Source Edit
proc updatePlot(ws: WebSocket; data: JsonNode; layout: JsonNode = nil) {. ...raises: [ValueError, Exception, OSError], tags: [RootEffect, TimeEffect, WriteIOEffect, ReadIOEffect], forbids: [].}
- Send message to websocket server to update the plot. Source Edit