Plot a diagram (directed graph) of top linkages
plotLinks(top_links_dt, wiot, units = list(units_suffix = "bn USD", mln_USD_exchange_rate = 0.001), country_labels_dt = wiod.diagrammer::countries(), sector_labels_dt = wiod.diagrammer::sectors(wiot), aggregates_dt = wiod.diagrammer::aggregates(wiot), arrowSizeFun = function(value) wiod.diagrammer:::normalise(value) * 16 + 1, arrowLabelFun = identity, nodeSizeFun = function(country_sector_dt) country_sector_dt %>% ifelse.(.$isFinal, .$II_fob, .$GO), nodeSizeTransformFun = function(node_size_val) wiod.diagrammer::normalise(log(node_size_val) + 1) * 8 + 8, nodeLabelFun = function(country_sector_dt) country_sector_dt %>% paste.(.$CountryLab, .$SectorLab, paste(.$NodeSize %>% numberFormattingFun, units$units_suffix), sep = ", "), specificNodeOptionsFun = function(country_sector_dt) ifelse(country_sector_dt$isFinal, "fontname=\"times-italic\"", ""), specificArrowOptionsFun = function(top_links_dt) ifelse(top_links_dt$ExpCountry == top_links_dt$ImpCountry, "style=solid", "style=dashed"), general_arrow_options = "color=grey", general_node_options = "shape=box", graph_options = c("layout=dot", "rankdir=LR"), numberFormattingFun = function(value) value %>% formatC(digits = 1, format = "f", big.mark = " "), nchar_wrap = 30, gvcode = FALSE)
top_links_dt | A data.table returned by |
---|---|
wiot | WIOD data.table returned by |
units | Optional: a list of two named interrelated elements:
|
country_labels_dt | Optional: a data.table with specific
columns -- see the documentation for countries which is
the function called to produce the default value for |
sector_labels_dt | Optional: a data.table with specific
columns -- see the documentation for sectors which is
the function called to produce the default value for |
aggregates_dt | Optional: a data.table with specific
columns -- see the documentation for aggregates which is
the function called to produce the default value for |
arrowSizeFun | Optional: a one-numeric-argument function which translates
|
arrowLabelFun | Optional: a one-numeric-argument function which translates
|
nodeSizeFun | Optional: a function which takes a country-and-sector level
data.table (including the columns of |
nodeSizeTransformFun | Optional: a one-argument function which takes
the numeric value returned by the function |
nodeLabelFun | Optional: a function which takes the country-and-sector-level
data.table -- a merger of |
specificNodeOptionsFun | Optional: a function which takes the country-and-sector-level
data.table and returns a character vector of GraphViz's node atributes*,
see ** with 'node' highlighted in
the 'COMPONENTS' section. Default: |
specificArrowOptionsFun | Optional: a function which takes |
general_arrow_options | Optional: a character constant (vector of length 1) with the GraphViz's edge
global atributes* of all the arrows (edges)
see ** with 'edge' highlighted in
the 'COMPONENTS' section. . Default: |
general_node_options | Optional: a character constant (vector of length 1) with the GraphViz's edge
global atributes* of all the nodes (country-sector boxes)
see ** with 'node' highlighted in
the 'COMPONENTS' section. Default: |
graph_options | Optional: character constant (vector of length 1) with the GraphViz's edge
global atributes* of the whole graph.
See ** with 'graph' highlighted in the 'COMPONENTS' section.
Default: |
numberFormattingFun | Optional: a one-numeric-argument function used to format all the numbers displayed in the graph. Default: it returns a character vector with values formated as one digit after decimal dot and blank as a digit-grouping separator. |
nchar_wrap | Optional: a numeric constant -- the number of characters arounnd which the text
of arrow labels (returned by |
gvcode | Optional: should the generated GraphViz code be returned instead
of the |
The return value of grViz
or the Graphviz code
if gvcode = TRUE
.
* in the form of comma-separate key=value pairs:
'attribute_name_1 = attribute_value_1, attribute_name_2 = attribute_value_2, ...'