| geo.change.attr | R Documentation |
The functions geo.change.attr changes values of a given node
attribute for a set of selected nodes of a gGraph object.
geo.change.attr(
x,
mode = c("points", "area"),
attr.name,
attr.value,
only.name = NULL,
only.value = NULL,
newCol = "black",
restore.edges = FALSE,
refObj = "rawgraph.40k"
)
x |
a valid gGraph object. |
mode |
a character string indicating whether selected nodes are clicked one by one ('points') or by defining a rectangular area ('area'). |
attr.name |
the name of the node attribute to be modified. |
attr.value |
the new value of attribute assigned to selected nodes. |
only.name |
(optional) in area mode, the name of a node attribute to add an extra selection criterion. See details. |
only.value |
(optional) in area mode, and if |
newCol |
a character string giving the new color for the attribute value. |
restore.edges |
a logical indicating whether edges stemming from the
modified nodes should be re-added to the graph, using |
refObj |
a character string or a gGraph object, used as reference when re-adding edges. If a character string is provided, it must match one of the following dataset: 'rawgraph.10k', 'rawgraph.40k'. |
The argument only.name allows one to perform a more accurate
selection of nodes whose attribute is changed, by specifying values
(only.value) of an attribute (only.name) that can be selected.
For instance, one may want to define new attributes for nodes of
worldgraph.10k that are exclusively on land: this would be done by
specifying only.name="habitat" and only.value="land".
A gGraph object with modified node attributes.
## Not run:
plot(worldgraph.10k, reset = TRUE)
## have to click here for an area
## all nodes are modified in the area
x <- geo.change.attr(worldgraph.10k, mode = "area", attr.name = "habitat", attr.value = "fancy
habitat", newCol = "pink") # modify selected area
plot(x, reset = TRUE) # modification in the whole selected area
## have to click here for an area
## only nodes on land are modified
x <- geo.change.attr(x, mode = "area", attr.name = "habitat", attr.value = "fancy2
habitat", newCol = "purple", only.name = "habitat", only.value = "land")
plot(x, reset = TRUE) # modification in the whole selected area
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.