write_tikz {stagedtrees}R Documentation

Export the staged tree or CEG graph to tikz

Description

Generate tikz code to draw the staged tree or CEG graph.

Usage

write_tikz(
  x,
  layout = NULL,
  file = "",
  col = NULL,
  ignore = x$name_unobserved,
  node_label = function(node) {
     ifelse(is.na(node$stage), "", node$stage)
 },
  edge_label = function(edge) {
     ifelse(is.na(edge$label), "", edge$label)
 },
  edge_label_options = function(edge) {
     return("sloped")
 },
  scale = 10,
  normalize_layout = TRUE,
  node_shape = "circle",
  node_inner_sep = "1mm",
  node_minimum_size = "0.3cm",
  node_draw_color = "black",
  node_thickness = "very thick",
  node_text_color = "black"
)

## S3 method for class 'sevt'
write_tikz(
  x,
  layout = NULL,
  file = "",
  col = NULL,
  ignore = x$name_unobserved,
  node_label = function(node) {
     ifelse(is.na(node$stage), "", node$stage)
 },
  edge_label = function(edge) {
     ifelse(is.na(edge$label), "", edge$label)
 },
  edge_label_options = function(edge) {
     return("sloped")
 },
  scale = 10,
  normalize_layout = TRUE,
  node_shape = "circle",
  node_inner_sep = "1mm",
  node_minimum_size = "0.3cm",
  node_draw_color = "black",
  node_thickness = "very thick",
  node_text_color = "black"
)

Arguments

x

an object of class sevt or ceg.

layout

the layout of the graph, given as matrix with two columns and as many rows as nodes in the staged tree. By default, a modified sugiyama layout is used. The layout matrix can be obtained with igraph layout functions.

file

A connection or a character string naming the file to print to. Passed to cat.

col

color specifications for the stages of the staged even tree. Same as plot.sevt and make_stages_col.

ignore

vector of stages which will be ignored and not plotted, by default the name of the unobserved stages stored in x$name_unobserved.

node_label

a function that produces nodes labels.

edge_label

a function that produces edge labels.

edge_label_options

a function that produces edge label options.

scale

for the tikzfigure.

normalize_layout

a logical value. If TRUE layout positions are scaled to the [0,1] interval.

node_shape

the shape to be used for nodes.

node_inner_sep

the inner sep parameter.

node_minimum_size

the minimum size parameter for the nodes.

node_draw_color

the color for line drawing the nodes.

node_thickness

the thickness of the lines.

node_text_color

the color for label in nodes.

Details

This function can be used to create a working tikz code that compile to a graph similar to the one obtained by plot.sevt(x, ...) or plot.ceg(x, ...).

References

Code partially inspired by the code in Exporting graphs to LaTeX, using igraph and TikZ http://igraph.wikidot.com/r-recipes#toc2


[Package stagedtrees version 2.3.0 Index]