# NOT RUN {
# Read data
imgs <- read.table(system.file("extdata", "imgs.tsv", package = "iconr"),
sep="\t",stringsAsFactors = FALSE)
nodes <- read.table(system.file("extdata", "nodes.tsv", package = "iconr"),
sep="\t",stringsAsFactors = FALSE)
edges <- read.table(system.file("extdata", "edges.tsv", package = "iconr"),
sep="\t",stringsAsFactors = FALSE)
# Generate list of graphs from the three dataframes
lgrph <- list_dec(imgs, nodes, edges)
# Generate all pairwise comparisons of the graphs with respect to nodes "type"
g.compar <- list_compar(lgrph, nd.var="type")
# Generate the image showing the comparison on common nodes of graphs
# '1' and '4', save it in png format, and return its path.
dataDir <- system.file("extdata", package = "iconr")
outDir <- tempdir()
plot_compar(g.compar, c(1,4), focus = "nodes",
dir = dataDir,
dir.out = outDir,
img.format = "png")
# Generate the image showing the comparison on common edges of all pairwise
# combinations of graphs '1','3', and '4', save them in pdf format, and return
# their path.
# Plot nodes involved in non-common edges in orange and
# nodes involved in common edges and the corresponding labels in brown.
plot_compar(g.compar, c(1, 3, 4), focus = "edges",
dir = dataDir,
nd.color = c("orange", "brown"),
dir.out = outDir,
img.format = "pdf")
# Save the png image showing the comparison on common nodes of graphs
# '1' and '4'.
# Then read and plot the image.
img.filename <- plot_compar(g.compar, c(1, 4), focus = "nodes",
dir = dataDir,
dir.out = outDir,
img.format = "png")
plot(magick::image_read(img.filename))
# Plot directly on the active device (default) the comparison on common nodes
# of graphs '1' and '4'.
plot_compar(g.compar, c(1, 4), focus = "nodes",
dir = dataDir)
# }
Run the code above in your browser using DataLab