Vectorized mypie() function for igraph vertex pie polygons
Source:R/jamenrich-igraphshapes.R
jam_mypie.RdVectorized mypie() function for igraph vertex pie polygons
Usage
jam_mypie(
x,
y,
values,
radius,
edges = 200,
col = NULL,
angle = 45,
density = NULL,
border = NULL,
frame.color = NULL,
frame.lwd = par("lwd"),
lty = NULL,
lwd = par("lwd"),
init.angle = 90,
inner_pie_border = getOption("inner_pie_border", TRUE),
inner_cex = 1.01,
xy_max = NULL,
overclose_polygons = FALSE,
...
)Arguments
- x, y
numericcoordinate for the center of eachigraphnode.- values
numericvector of relative pie wedge sizes.- radius
numericradius of pie- edges
integernumber of edges to make a circle- col
charactervector of R colors to fill each pie wedge, in order- angle, density
used to draw lines to fill each pie node, passed to
polygon()- border
charactervector of R colors for each pie wedge border- frame.color
characterR color used around the entire pie circle.- lty
numericorcharacterline type- init.angle
numericangle in degrees (0 to 360) where0is the top of the circle, proceeding clockwide.- inner_pie_border
logicalwhether to applypie.bordercolors only along the inside of each pie wedge polygon, so that adjacent colors will be seen beside each other without overlapping adjacent borders. This method is currently in development.- overclose_polygons
logicalindicating whether to close polygon coordinates with an extra couple points, to ensure the line join"ljoin"is properly called when drawing each polygon.- ...
additional arguments are passed to
polygon()
Value
data.frame with columns suitable for use in polygon()
after each column is expanded to vector form. Columns x and y
are stored AsIs() in list format, and should be combined
with one NA value between each numeric vector. The NA values
cause polygon() to draw a series of separate polygons in
one vectorized step, much faster than drawing a series of
polygons in an iterative loop.
Details
This is a function called internally by shape.jampie.plot(),
not intended for direct use.
See reorder_igraph_nodes() for visual examples.
This function is a light rewrite of igraph:::mypie(), except
that this function determines polygon coordinates without
drawing them, instead returns the polygon coordinates to
the calling function shape.jampie.plot() which in turn
draws all polygons once using the vectorized approach
described for graphics::polygon().
See shape.jampie.plot() for more detail.
To disable pie.border set to NA with vertex.pie.border=NA
or V(g)[[2]]$pie.border <- NA.
To disable frame.color set to NA with vertex.frame.color=NA
or V(g)[2]$frame.color <- NA.
See also
Other jam igraph shapes:
shape.coloredrectangle.plot(),
shape.ellipse.clip(),
shape.ellipse.plot(),
shape.jampie.plot()