Skip to contents

(advance usage) outputs a dtrackr history graph as a DOT string for rendering with Graphviz

Usage

p_get_as_dot(
  .data,
  fill = .defaultFill(),
  fontsize = .defaultFontSize(),
  colour = .defaultColour(),
  rankdir = .defaultDirection(),
  rounded = .defaultRounded(),
  fontname = .defaultFontName(),
  bgcolour = .defaultBgColour(),
  ...
)

Arguments

.data

the tracked dataframe

fill

the default node fill colour, any R colour or hex value

fontsize

the default font size in points

colour

the default font colour, any R colour or hex value

rankdir

the dot rank direction (one of TB,LR,BT,RL)

rounded

should the node corners be rounded?

fontname

the font to use. Must exist on the system.

bgcolour

the background, may be "transparent", any R colour or hex value

...

not used

Value

a representation of the history graph in Graphviz dot format.

Examples

library(dplyr)
library(dtrackr)

tmp = iris %>% track() %>% comment(.tag = "step1") %>% filter(Species!="versicolor")
dot = tmp %>% dplyr::group_by(Species) %>% comment(.tag="step2") %>% p_get_as_dot()
cat(dot)
#> digraph {
#>      graph [layout = 'dot',
#>         splines='ortho',
#>         rankdir = 'TB',
#>         outputorder = 'edgesfirst',
#>         bgcolor = '#FFFFFF',
#>         ranksep = '0.25',
#>         nodesep = '0.2',
#>         newrank='true']
#> 
#>     node [fontname = 'Helvetica',
#>         fontsize = '8',
#>         shape='box',
#>         fixedsize = 'false',
#>         margin = '0.1,0.1',
#>         width = '0',
#>         height = '0',
#>         style = 'filled',
#>         color = '#000000',
#>         fontcolor = '#000000',
#>         labeljust='l']
#> 
#>     edge [fontname = 'Helvetica',
#>         fontsize = '8',
#>         len = '0.5',
#>         color = '#000000',
#>         arrowsize = '0.5']
#>     
#> { rank='same';
#> '5' [label=<<B>setosa</B><BR ALIGN='LEFT'/>50 items<BR ALIGN='LEFT'/>>,group='setosa',fillcolor='#FFFFFF'];
#> '6' [label=<<B>virginica</B><BR ALIGN='LEFT'/>50 items<BR ALIGN='LEFT'/>>,group='virginica',fillcolor='#FFFFFF'];
#> }
#> { rank='same';
#> '4' [label=<stratify by Species<BR ALIGN='LEFT'/>>,group='',fillcolor='#FFFFFF'];
#> }
#> { rank='same';
#> '2' [label=<150 items<BR ALIGN='LEFT'/>>,group='',fillcolor='#FFFFFF'];
#> '3' [label=<excluded 50 items<BR ALIGN='LEFT'/>>,group='',fillcolor='#CCCCCC'];
#> }
#> { rank='same';
#> '1' [label=<150 items<BR ALIGN='LEFT'/>>,group='',fillcolor='#FFFFFF'];
#> }
#> 
#> 
#> '4' -> '6' [tailport='s',weight='100']
#> '4' -> '5' [tailport='s',weight='100']
#> '2' -> '4' [tailport='s',weight='100']
#> '2' -> '3' [tailport='e',weight='1']
#> '1' -> '2' [tailport='s',weight='100']
#> }