Learn R Programming

RGraphSpace (version 1.1.1)

geom_nodespace: Draw node elements in a 2D graph layout

Description

Constructor for GeomNodeSpace ggproto objects, a variant of geom_point supporting node attributes from GraphSpace objects.

This geom is designed to create node-level aesthetics such as `size`, `fill`, `colour`, or any custom aesthetics defined in `GeomNodeSpace`.

Usage

geom_nodespace(
  mapping = NULL,
  data = NULL,
  stat = "identity",
  position = "identity",
  ...,
  na.rm = TRUE,
  show.legend = NA,
  inherit.aes = FALSE
)

Value

A ggplot2 layer that renders node glyphs defined by `GeomNodeSpace`.

Arguments

mapping

Set of aesthetic mappings created by [ggplot2::aes()]. These mappings apply to the layer and may override global aesthetics.

data

Either a GraphSpace object or a data frame containing node attributes. If `NULL`, the layer will use the default plot data.

stat

The statistical transformation to use on the data. Defaults to `"identity"`.

position

Position adjustment, either as a string or the result of a call to a position adjustment function.

...

Additional parameters passed to the underlying drawing function in `GeomNodeSpace`.

na.rm

Logical. Should missing values be removed? Defaults to `TRUE`.

show.legend

Logical or a named logical vector indicating whether this layer should be included in legends.

inherit.aes

Logical. If `FALSE` (default), the layer will use aesthetics defined in `mapping`. Set to `TRUE` if this geom should inherit aesthetics from the plot.

Aesthetics

`geom_nodespace` understands the following aesthetics:

  • `x` Horizontal position in `npc` unit (required).

  • `y` Vertical position in `npc` unit (required).

  • `size` Node size in `npc` unit (required).

  • `fill` Node fill colour.

  • `colour` Node line colour.

  • `shape` Integer code between 0 and 25 (see points).

  • `linewidth` Line width, using 'lwd' standard graphics unit (see gpar).

  • `alpha` Transparency applied to fill and line colour.

See Also

GeomNodeSpace, GraphSpace

Examples

Run this code

# Load a demo igraph
data('gtoy1', package = 'RGraphSpace')

# Create a GraphSpace object
gs <- GraphSpace(gtoy1)

if (FALSE) {

ggplot() + geom_nodespace(aes(x = x, y = y), data = gs)

}

Run the code above in your browser using DataLab