1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/node_aes.R
3\name{node_aes}
4\alias{node_aes}
5\title{Insert node aesthetic attributes during node creation}
6\usage{
7node_aes(
8  shape = NULL,
9  style = NULL,
10  penwidth = NULL,
11  color = NULL,
12  fillcolor = NULL,
13  image = NULL,
14  fontname = NULL,
15  fontsize = NULL,
16  fontcolor = NULL,
17  peripheries = NULL,
18  height = NULL,
19  width = NULL,
20  x = NULL,
21  y = NULL,
22  group = NULL,
23  tooltip = NULL,
24  xlabel = NULL,
25  URL = NULL,
26  sides = NULL,
27  orientation = NULL,
28  skew = NULL,
29  distortion = NULL,
30  gradientangle = NULL,
31  fixedsize = NULL,
32  labelloc = NULL,
33  margin = NULL
34)
35}
36\arguments{
37\item{shape}{The shape to use for the node. Some possible \code{shape} types
38include: \code{circle}, \code{rectangle}, \code{triangle}, \code{plaintext}, \code{square}, and
39\code{polygon}.}
40
41\item{style}{The node line style. The \code{style} types that can be used are:
42\code{filled}, \code{invisible}, \code{diagonals}, \code{rounded}, \code{dashed}, \code{dotted}, \code{solid},
43and \code{bold}.}
44
45\item{penwidth}{The thickness of the stroke line (in pt units) for the node
46shape. The default value is \code{1.0}.}
47
48\item{color}{The color of the node's outline. Can be any of the named colors
49that R knows about (obtained using the \code{colors()} function), or, a
50hexadecimal color code.}
51
52\item{fillcolor}{The color with which to fill the shape of the node. Can be
53any of the named colors that R knows about (obtained using the \code{colors()}
54function), or, a hexadecimal color code.}
55
56\item{image}{A reference to an image location.}
57
58\item{fontname}{The name of the system font that will be used for any node
59text.}
60
61\item{fontsize}{The point size of the font used for any node text.}
62
63\item{fontcolor}{The color used for any node text. Can be any of the named
64colors that R knows about (obtained using the \code{colors()} function), or, a
65hexadecimal color code.}
66
67\item{peripheries}{The repeated number of node shapes (of increasing size) to
68draw at the node periphery.}
69
70\item{height}{The height of the node shape, in inches. The default value is
71\code{0.5} whereas the minimum value is \code{0.02}. This is understood as the
72initial, minimum height of the node. If \code{fixedsize} is set to \code{TRUE}, this
73will be the final height of the node. Otherwise, if the node label requires
74more height to fit, the node's height will be increased to contain the
75label.}
76
77\item{width}{The width of the node shape, in inches. The default value is
78\code{0.5} whereas the minimum value is \code{0.02}. This is understood as the
79initial, minimum width of the node. If \code{fixedsize} is set to \code{TRUE}, this
80will be the final width of the node. Otherwise, if the node label requires
81more width to fit, the node's width will be increased to contain the label.}
82
83\item{x}{The fixed position of the node in the x direction. Any integer-based
84or floating point value will be accepted.}
85
86\item{y}{The fixed position of the node in the y direction. Any integer-based
87or floating point value will be accepted.}
88
89\item{group}{The node group.}
90
91\item{tooltip}{Text for a node tooltip.}
92
93\item{xlabel}{External label for a node. The label will be placed outside of
94the node but near it. These labels are added after all nodes and edges have
95been placed. The labels will be placed so that they do not overlap any node
96or label. This means it may not be possible to place all of them.}
97
98\item{URL}{A URL to associate with a node. Upon rendering the plot, clicking
99nodes with any associated URLs will open the URL in the default browser.}
100
101\item{sides}{When using the shape \code{polygon}, this value will provide the
102number of sides for that polygon.}
103
104\item{orientation}{This is the angle, in degrees, that is used to rotate
105nodes that have a \code{shape} of \code{polygon}. Not that for any of the polygon
106shapes (set by the \code{sides} node attribute), a value for \code{orientation} that
107is \code{0} results in a flat base.}
108
109\item{skew}{A \code{0-1} value that will result in the node shape being skewed to
110the right (from bottom to top). A value in the range \code{0} to \code{-1} will skew
111the shape to the left.}
112
113\item{distortion}{A distortion factor that is used only when a \code{shape} of
114\code{polygon} is used. A \code{0-1} value will increasingly result in the top part
115of the node polygon shape to be larger than the bottom. Moving from \code{0}
116toward \code{-1} will result in the opposite distortion effect.}
117
118\item{gradientangle}{The path angle for the node color fill gradient.}
119
120\item{fixedsize}{If set to \code{FALSE}, the size of a node is determined by
121smallest width and height needed to contain its label, if any, with a
122margin specified by the \code{margin} node attribute. The width and height must
123also be at least as large as the sizes specified by the \code{width} and
124\code{height} node attributes, which specify the minimum values. If set to
125\code{TRUE}, the node size is entirely specified by the values of the \code{width}
126and \code{height} node attributes (i.e., the node is not expanded in size to
127contain the text label).}
128
129\item{labelloc}{Sets the vertical placement of labels for nodes and clusters.
130This attribute is used only when the height of the node is larger than the
131height of its label. The \code{labelloc} node attribute can be set to either \code{t}
132(top), \code{c} (center), or \code{b} (bottom). By default, the label is vertically
133centered.}
134
135\item{margin}{Sets the amount of space around the node's label. By default,
136the value is \verb{0.11,0.055}.}
137}
138\description{
139This helper function should be invoked to provide values for the namesake
140\code{node_aes} argument, which is present in any function where nodes are
141created.
142}
143\examples{
144# Create a new graph and add
145# a path with several node
146# aesthetic attributes
147graph <-
148  create_graph() \%>\%
149  add_path(
150    n = 3,
151    type = "path",
152    node_aes = node_aes(
153      shape = "circle",
154      x = c(1, 3, 2),
155      y = c(4, -1, 3)
156    )
157  )
158
159# View the graph's internal
160# node data frame; the node
161# aesthetic attributes have
162# been inserted
163graph \%>\% get_node_df()
164
165# Create a new graph which is
166# fully connected
167graph <-
168  create_graph() \%>\%
169  add_full_graph(
170    n = 4,
171    node_data = node_data(value = 1:4),
172    node_aes = node_aes(
173      x = c(2, 1, 3, 2),
174      y = c(3, 2, 2, 1)
175    ),
176    edge_aes = edge_aes(color = "blue")
177  )
178}
179\seealso{
180Other Aesthetics:
181\code{\link{edge_aes}()},
182\code{\link{node_edge_aes_data}}
183}
184\concept{Aesthetics}
185