Learn R Programming

network (version 1.20.0)

network.loop: Add Loops to a Plot

Description

network.loop draws a "loop" at a specified location; this is used to designate self-ties in plot.network.

Usage

network.loop(
  x0,
  y0,
  length = 0.1,
  angle = 10,
  width = 0.01,
  col = 1,
  border = 1,
  lty = 1,
  offset = 0,
  edge.steps = 10,
  radius = 1,
  arrowhead = TRUE,
  xctr = 0,
  yctr = 0,
  ...
)

Arguments

Value

None.

Details

network.loop is the companion to network.arrow; like the latter, plot elements produced by network.loop are drawn using polygon, and as such are scaled based on the current plotting device. By default, loops are drawn so as to encompass a circular region of radius radius, whose center is offset units from x0,y0 and at maximum distance from xctr,yctr. This is useful for functions like plot.network, which need to draw loops incident to vertices of varying radii.

See Also

network.arrow, plot.network, polygon

Examples

Run this code

#Plot a few polygons with loops
plot(0,0,type="n",xlim=c(-2,2),ylim=c(-2,2),asp=1)
network.loop(c(0,0),c(1,-1),col=c(3,2),width=0.05,length=0.4,
  offset=sqrt(2)/4,angle=20,radius=0.5,edge.steps=50,arrowhead=TRUE)
polygon(c(0.25,-0.25,-0.25,0.25,NA,0.25,-0.25,-0.25,0.25), 
    c(1.25,1.25,0.75,0.75,NA,-1.25,-1.25,-0.75,-0.75),col=c(2,3))


Run the code above in your browser using DataLab