Package sigmanet. April 23, 2018

Similar documents
Package slickr. March 6, 2018

Package canvasxpress

Package jstree. October 24, 2017

Package pairsd3. R topics documented: August 29, Title D3 Scatterplot Matrices Version 0.1.0

Package htmlwidgets. July 10, 2017

Package htmlwidgets. February 25, 2016

Package d3plus. September 25, 2017

Package profvis. R topics documented:

Package d3heatmap. February 1, 2018

Package processanimater

Package shinyaframe. November 26, 2017

Package shiny.semantic

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package datasets.load

Package TnT. November 22, 2017

Package htmltidy. September 29, 2017

Package vdiffr. April 27, 2018

Package barcoder. October 26, 2018

Package editdata. October 7, 2017

Package collapsibletree

Package tiler. June 9, 2018

Package gtrendsr. October 19, 2017

Package colourpicker

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package gtrendsr. August 4, 2018

Package shinytest. May 7, 2018

Package shinyfeedback

Package docxtools. July 6, 2018

Package messaging. May 27, 2018

Package pdfsearch. July 10, 2018

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package repec. August 31, 2018

Package projector. February 27, 2018

Package data.world. April 5, 2018

Package robotstxt. November 12, 2017

Package scatterd3. March 10, 2018

Package tfruns. February 18, 2018

Package fitbitscraper

Package bisect. April 16, 2018

Package calpassapi. August 25, 2018

Package fastdummies. January 8, 2018

Package kdtools. April 26, 2018

Package facerec. May 14, 2018

Package autoshiny. June 25, 2018

Package deckgl. November 19, 2018

Package condformat. October 19, 2017

Package carbonate. R topics documented: October 14, 2018

Package tablehtml. November 5, 2017

Package radix. September 17, 2018

Package knitrprogressbar

Package goodpractice

Package lumberjack. R topics documented: July 20, 2018

Package tabulizer. June 7, 2018

Package ECctmc. May 1, 2018

Package validara. October 19, 2017

Package SEMrushR. November 3, 2018

Package WordR. September 7, 2017

Package vip. June 15, 2018

Package qualmap. R topics documented: September 12, Type Package

Package shinyhelper. June 21, 2018

Package fastqcr. April 11, 2017

Package manet. September 19, 2017

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package rsppfp. November 20, 2018

Package mapr. April 11, 2017

Package spelling. December 18, 2017

Package oec. R topics documented: May 11, Type Package

Package opencage. January 16, 2018

Package regexselect. R topics documented: September 22, Version Date Title Regular Expressions in 'shiny' Select Lists

Package knitrbootstrap

Package ipc. January 12, 2019

Package metricsgraphics

Package modules. July 22, 2017

Package patentsview. July 12, 2017

Package ggextra. April 4, 2018

Package tidylpa. March 28, 2018

Package githubinstall

Package spark. July 21, 2017

Package revealjs. R topics documented: March 13, Type Package

Package texpreview. August 15, 2018

Package statsdk. September 30, 2017

Package weco. May 4, 2018

Package widyr. August 14, 2017

Package eply. April 6, 2018

Package wrswor. R topics documented: February 2, Type Package

Package semantic.dashboard

Package mapedit. R topics documented: March 2, Title Interactive Editing of Spatial Data in R

Package rzeit2. January 7, 2019

Package postal. July 27, 2018

Package meme. December 6, 2017

Package TrafficBDE. March 1, 2018

Package jpmesh. December 4, 2017

Package meme. November 2, 2017

Package effectr. January 17, 2018

Package pmatch. October 19, 2018

Package ezknitr. September 16, 2016

Package sigqc. June 13, 2018

Package loggit. April 9, 2018

Package linkspotter. July 22, Type Package

Transcription:

Title Render Graphs Using 'Sigma.js' Version 1.1.0 Maintainer Ian Kloo <iankloo@gmail.com> URL https://github.com/iankloo/manet Package manet April 23, 2018 BugReports https://github.com/iankloo/manet/issues Create interactive graph visualizations using 'Sigma.js' <http://majs.org/>. This package is meant to be used in conjunction with 'igraph', replacing the (somewhat underwhelming) plotting features of the package. The idea is to quickly render graphs, regardless of their size, in a way that allows for easy, iterative modification of aesthetics. Because 'Sigma.js' is a 'javascript' library, the visualizations are inherently interactive and are well suited for integration with 'Shiny' apps. While there are several 'htmlwidgets' focused on network visualization, they tend to underperform on medium to large sized graphs. 'Sigma.js' was dened for larger network visualizations and this package aims to make those strengths available to 'R' users. Depends R (>= 2.10) License MIT + file LICENSE Encoding UTF-8 LazyData true Imports htmlwidgets, igraph, jsonlite, RColorBrewer RoxygenNote 6.0.1 Suggests magrittr, knitr, rmarkdown, shiny VignetteBuilder knitr NeedsCompilation no Author Ian Kloo [aut, cre] Repository CRAN Date/Publication 2018-04-23 19:34:26 UTC 1

2 addedgecolors R topics documented: addedgecolors....................................... 2 addedgesize........................................ 3 addinteraction........................................ 4 addlistener......................................... 5 addnodecolors....................................... 5 addnodelabels....................................... 6 addnodesize........................................ 7 lesmis............................................ 8 rendersigmanet....................................... 9 savesigma.......................................... 10 mafromigraph...................................... 11 manetoutput....................................... 12 Index 13 addedgecolors Modify the edge colors of a manet object. Modify the edge colors of a manet object by providing either: (1) a single color to use for every edge; or (2) an attribute of the initial igraph object that will be used to determine color. addedgecolors(maobj, onecolor = NULL, colorattr = NULL, colorpal = "Set2") maobj onecolor colorattr colorpal A manet object - created using the mafromigraph function A single color to color all of the nodes (hex format) An attribute from the original igraph nodes to color the nodes by The color palatte to use - only used if colorattr is specified Details If the 2nd option is used, you can also specify a color palette from RColorBrewer. A manet object with modified node labels. This object can be called directly to create a visualization, or modified by additional functions.

addedgesize 3 library(manet) #one color for all edges <- mafromigraph(graph = lesmis, layout = l) %>% addedgecolors(onecolor = '#D95F02') addedgesize Modify the edge size of a manet object. Modify the edge size of a manet object by providing one of the following: (1) a single size to use for all edges; or (2) an attribute in the initial igraph to be used to size the edges. addedgesize(maobj, sizeattr = NULL, minsize = 1, maxsize = 5, onesize = NULL) maobj sizeattr minsize maxsize onesize A manet object - created using the mafromigraph function The attribute to use to create edge size (width) The minimum size of the edges (for scaling) The maximum size of the edges (for scaling) A single size to use for all edges Details If the 2nd method is used, the minsize and maxsize attribute will control lower and upper bounds of the scaling function. A manet object with modified node labels. This object can be called directly to create a visualization, or modified by additional functions.

4 addinteraction library(manet) #specify a single edge size <- mafromigraph(graph = lesmis, layout = l) %>% addedgesize(onesize = 5) #specify an attribute and min/max <- mafromigraph(graph = lesmis, layout = l) %>% addedgesize(sizeattr = 'value', minsize =.1, maxsize = 2) addinteraction Modify the interactivity of a manet object. Modify the interactivity of a manet object using the below options. By default, visualizations include on-click neighbor events, double-click zoom, and mouse-wheel zoom. These can all be disabled or modified per the below options. addinteraction(maobj, neighborevent = "onclick", doubleclickzoom = TRUE, mousewheelzoom = TRUE) maobj neighborevent A manet object - created using the mafromigraph function Enable/disable event that highlights a node s neighbors. Can either be onclick, onhover, or None. doubleclickzoom Enable/disable zoom event on double click mousewheelzoom Enable/disable zoom event on mouse wheel

addlistener 5 library(manet) #change neighbor highlighting to on-hover, disable double-click zoom, enable mouse-wheel zoom <- mafromigraph(graph = lesmis, layout = l) %>% addinteraction(neighborevent = 'onhover', doubleclickzoom = FALSE, mousewheelzoom = TRUE) addlistener Add a "listener" to report data from a manet object in Shiny back to the R session. Add a "listener" to report data from a manet object in Shiny back to the R session. addlistener(maobj, listener) maobj listener A manet object - created using the mafromigraph function Either "clicknode" to listen to node clicks or "hovernode" to listen to node hover addnodecolors Modify the node colors of a manet object. Modify the node colors in an existing manet object by providing one of the following: (1) a single color to use for all nodes or; (2) a vertex attribute from your original igraph object. If you are using a vertex attribute, you can also specify a color palette from the RColorBrewer package. addnodecolors(maobj, onecolor = NULL, colorattr = NULL, colorpal = "Dark2")

6 addnodelabels maobj onecolor colorattr colorpal A manet object - created using the mafromigraph function A single color to color all of the nodes (hex format) An attribute from the original igraph nodes to color the nodes by The color palatte to use - only used if colorattr is specified Details *It is most useful to use the pipe operator from the magrittr package with this function. A manet object with modified node colors. visualization, or modified by additional functions. This object can be called directly to create a library(manet) #one color for all nodes <- mafromigraph(graph = lesmis, layout = l) %>% addnodecolors(onecolor = '#D95F02') #color based on attribute (edge betweenness cluster) clust <- cluster_edge_betweenness(lesmis)$membership V(lesMis)$group <- clust <- mafromigraph(graph = lesmis, layout = l) %>% addnodecolors(colorattr = 'group', colorpal = 'Set1') addnodelabels Modify the node labels of a manet object. Modify the node labels of an existing manet object by providing an attribute from the initial igraph to use as the labels.

addnodesize 7 addnodelabels(maobj, labelattr = NULL) maobj labelattr A manet object - created using the mafromigraph function The attribute to use to create node labels A manet object with modified node labels. This object can be called directly to create a visualization, or modified by additional functions. library(manet) <- mafromigraph(graph = lesmis, layout = l) %>% addnodelabels(labelattr = 'label') addnodesize Modify the node size of a manet object. Modify the node size of an existing manet object by providing one of the following: (1) A single size to use for all nodes; (2) a vector of node sizes (this must be the same length as the number of nodes in the graph); or (3) a metric to use to scale the nodes. addnodesize(maobj, minsize = 1, maxsize = 3, sizemetric = "degree", sizevector = NULL, onesize = NULL) maobj minsize maxsize A manet object - created using the mafromigraph function The minimum node size on the graph (for scaling) The maximum node size on the graph (for scaling)

8 lesmis sizemetric sizevector onesize The metric to use when sizing the nodes. Options are: degree, closeness, betweenness, pagerank, or eigencentrality. An optional vector with the sizes for each node (overrides sizemetric and min/maxsize) A single size to use for all nodes Details If using the 2nd or 3rd approach, specifying the minsize and maxsize attributes will scale the nodes according to your specification, between these min- and max sizes. A manet object with modified node sizes This object can be called directly to create a visualization, or modified by additional functions. library(manet) #one size for all nodes <- mafromigraph(graph = lesmis, layout = l) %>% addnodesize(onesize = 3) #using a size attribute <- mafromigraph(graph = lesmis, layout = l) %>% addnodesize(sizemetric = 'degree', minsize = 2, maxsize = 8) #using a vector customsize <- log10(degree(lesmis)) <- mafromigraph(graph = lesmis, layout = l) %>% addnodesize(sizevector = customsize) lesmis Co-appearances of characters in "Les Miserables" A graph where the nodes are characters in "Les Miserables" and the edges are times that the characters appeared together in the novel.

rendersigmanet 9 lesmis Format An igraph object with 77 nodes and 254 edges id numeric id of nodes label character label (names) of nodes value numeric weight of the edges (number of co-appearances) Source D. E. Knuth, The Stanford GraphBase: A Platform for Combinatorial Computing, Addison-Wesley, Reading, MA (1993) rendersigmanet Render a manet visualization in Shiny Render a manet visualization in Shiny rendersigmanet(expr, env = parent.frame(), quoted = FALSE) expr env quoted An expression that creates a manet visualization Defaults to parent.frame() - see Shiny docs for more info Defaults to FALSE - see Shiny docs for more info

10 savesigma savesigma Save manet object as html - a wrapper for savewidget() Save an manet object as an html file (without rendering it). This is especially helpful when dealing with very large graphs that could crash your R session if you attempt to render them in the Rstudio viewer pane. savesigma(maobj, filename = NULL) maobj filename A manet object - created using the mafromigraph function A name for your html output (with or without.html at the end) An html file in your working directory (or other specified directory). This file is a standalone representation of your Sigma.js visualization that can be shared and moved freely. This object will maintain it s interactivity. library(manet) <- mafromigraph(graph = lesmis, layout = l) ## Not run: savesigma(, filename = file.path(tempdir(), 'myfile.html')) ## End(Not run)

mafromigraph 11 mafromigraph Make a basic manet graph object from an igraph object Create a manet object from an igraph object. The manet object will be a basic visualization of the igraph object and is meant to be the starting point for the development of a useful Sigma.js visualization. If you are familiar with the ggplot syntax, this is similar to the basic ggplot function. mafromigraph(graph, layout = NULL, width = NULL, height = NULL, elementid = NULL) graph layout width height elementid An igraph object The output of one of the igraph layout functions. If not provided, layout_nicely() will be used (note, this will slow things down). Width of the resulting graph - defaults to fit container, probably leave this alone Height of the resulting graph - defaults to fit container, probably leave this alone Do not specify, this is used by the htmlwidgets package A manet object (which is an htmlwidget ). This object is meant to be called directly to render a default Sigma.js visualization, or it can be passed to other arguments to change visualization attributes (colors, sizes, interactivity, etc.). library(manet) <- mafromigraph(graph = lesmis, layout = l) #render basic visualization by calling the object

12 manetoutput manetoutput Create a UI element for a manet visualization in Shiny Create a UI element for a manet visualization in Shiny manetoutput(outputid, width = "100%", height = "400px") outputid width height The ID of the UI element The width of the UI element The height of the UI element

Index Topic datasets lesmis, 8 addedgecolors, 2 addedgesize, 3 addinteraction, 4 addlistener, 5 addnodecolors, 5 addnodelabels, 6 addnodesize, 7 lesmis, 8 rendersigmanet, 9 savesigma, 10 mafromigraph, 11 manetoutput, 12 13