Package 'grPipe'

Title: Graphviz Pipeline Plot Based on Grids (grPipe: Graphviz Pipeline)
Description: Create a grid-based graphviz using the following functions: 1 - Creating the data.frame where the nodes are; 2 - Adding and editing nodes; 3 - Plotting these nodes.
Authors: Daniel Gaspar Gonçalves [aut, cre]
Maintainer: Daniel Gaspar Gonçalves <[email protected]>
License: GPL (>= 3)
Version: 0.2.0
Built: 2024-10-31 18:36:30 UTC
Source: https://github.com/d-gaspar/grpipe

Help Index


Create New Graphviz Data.Frame (grPipe Nodes)

Description

if nrow or ncol parameters are equal zero, then the output will be an empty data.frame.

Usage

grPipe.create(nrow = 0, ncol = 0)

Arguments

nrow

integer

ncol

integer

Value

Returns a data.frame with 3 columns (id, id_next and text) where:

  • if nrow==0 or ncol==0, then return an empty data.frame;

  • if nrow>0 and ncol>0, then return a data.frame with one row:

    • id = paste0(LETTERS[nrow], ncol)

    • id_next = NA

    • text = NA

    • attr = NA

    • image = NA

Author(s)

Daniel Gaspar Gonçalves

Examples

nodes = grPipe.create()
nodes = grPipe.create(nrow = 2, ncol = 5)

Add or Update grPipe Nodes

Description

add a new node if it doesn't exist or update an existing one.

Usage

grPipe.node(
  nodes,
  id,
  id_next,
  text,
 
    attr = "style=filled, shape=box, fillcolor='#d3d3d3', color='#d3d3d3', margin='0.2,0'",
  image = NA
)

Arguments

nodes

data.frame

id

character

id_next

character

text

character

attr

character

image

character

Value

Returns a data.frame with 5 columns (id, id_next, text, attr and image) where:

  • If id and id_next already exist in the data.frame nodes, then return the data.frame nodes with the value text updated;

  • Otherwise, add a row in the data.frame nodes with the values passed (id, id_next and text) and then return the data.frame nodes.

Author(s)

Daniel Gaspar Gonçalves

Examples

nodes = grPipe.create(2,5)
nodes = grPipe.node(nodes, "A1",  "A2",  "input")
nodes = grPipe.node(nodes, "A2",  "B2",  "step 1")
nodes = grPipe.node(nodes, "B2",  "B3",  "step 2")
nodes = grPipe.node(nodes, "B3",  "B4",  "step 3")
nodes = grPipe.node(nodes, "B4",  "A4",  "step 4")
nodes = grPipe.node(nodes, "A4",  "A5",  "step 5")
nodes = grPipe.node(nodes, "A5",  NA,  "output")

Plot grPipe Nodes

Description

save grPipe nodes in pngfile path.

Usage

grPipe.plot(
  nodes,
  pngfile,
  title = "",
  plot = TRUE,
  showGrid = FALSE,
  colSpace = 0.5,
  rowSpace = 0.5
)

Arguments

nodes

data.frame

pngfile

character

title

character

plot

logical

showGrid

logical

colSpace

numeric

rowSpace

numeric

Value

No return value.

Author(s)

Daniel Gaspar Gonçalves

Examples

nodes = grPipe.create(2,5)
nodes = grPipe.node(nodes, "A1",  "A2",  "input")
nodes = grPipe.node(nodes, "A2",  "B2",  "step 1")
nodes = grPipe.node(nodes, "B2",  "B3",  "step 2")
nodes = grPipe.node(nodes, "B3",  "B4",  "step 3")
nodes = grPipe.node(nodes, "B4",  "A4",  "step 4")
nodes = grPipe.node(nodes, "A4",  "A5",  "step 5")
nodes = grPipe.node(nodes, "A5",  NA,  "output")
grPipe.plot(nodes, tempfile(), showGrid = TRUE)
grPipe.plot(nodes, tempfile(), showGrid = FALSE)