drawEllipse: Draw ellipse

drawEllipseR Documentation

Draw ellipse

Description

Draw ellipse

Usage

drawEllipse(
  x,
  y,
  a = 1,
  b = 1,
  angle = 0,
  segment = NULL,
  arc.only = TRUE,
  nv = 100,
  deg = TRUE,
  border = NULL,
  col = NA,
  lty = 1,
  lwd = 1,
  draw = TRUE,
  ...
)

Arguments

x, y

numeric coordinates, where x can be a two-column numeric matrix of x,y coordinates.

a, b

numeric values indicating x- and y-axis radius, before rotation if angle is non-zero.

angle

numeric value indicating the rotation of ellipse.

segment

NULL or numeric vector of two values indicating the start and end angles for the ellipse, prior to rotation.

arc.only

logical indicating whether to draw the ellipse arc without connecting to the center of the ellipse. Set arc.only=FALSE when segment does not include the full circle, to draw only the wedge.

nv

numeric the number of vertices around the center to draw.

deg

logical indicating whether input angle and segment values are in degrees, or deg=FALSE for radians.

border, col, lty, lwd

arguments passed to graphics::polygon().

draw

logical indicating whether to draw the ellipse.

...

additional arguments are passed to graphics::polygon() when draw=TRUE.

Details

This function draws an ellipse centered on the given coordinates, rotated the given degrees relative to the center point, with give x- and y-axis radius values.

Value

invisible list of x,y coordinates

See Also

Other jam igraph functions: cnet2df(), cnet2im(), cnetplotJam(), cnetplot_internalJam(), color_edges_by_nodegroups(), color_edges_by_nodes_deprecated(), color_edges_by_nodes(), color_nodes_by_nodegroups(), communities2nodegroups(), edge_bundle_bipartite(), edge_bundle_nodegroups(), enrichMapJam(), fixSetLabels(), flip_edges(), get_bipartite_nodeset(), igraph2pieGraph(), jam_igraph(), jam_plot_igraph(), label_communities(), layout_with_qfrf(), layout_with_qfr(), mem2emap(), memIM2cnet(), mem_multienrichplot(), nodegroups2communities(), rectifyPiegraph(), relayout_with_qfr(), removeIgraphBlanks(), removeIgraphSinglets(), reorderIgraphNodes(), rotate_igraph_layout(), spread_igraph_labels(), subgraph_jam(), subsetCnetIgraph(), subset_igraph_components(), sync_igraph_communities(), with_qfr()

Examples

par("mar"=c(2, 2, 2, 2));
plot(NULL,
   type="n",
   xlim=c(-5, 20),
   ylim=c(-5, 18),
   ylab="", xlab="", bty="L",
   asp=1);
xy <- drawEllipse(
   x=c(1, 11, 11, 11),
   y=c(1, 11, 11, 11),
   a=c(5, 5, 5*1.5, 5),
   b=c(2, 2, 2*1.5, 2),
   angle=c(20, -15, -15, -15),
   segment=c(0, 360, 0, 120, 120, 240, 240, 360),
   arc.only=c(TRUE, FALSE, FALSE, TRUE),
   col=jamba::alpha2col(c("red", "gold", "dodgerblue", "darkorchid"), alpha=0.5),
   border=c("red", "gold", "dodgerblue", "darkorchid"),
   lwd=1,
   nv=99)
points(x=c(1, 11), y=c(1, 11), pch=20, cex=2)
jamba::drawLabels(x=c(12, 3, 13, 5),
   y=c(14, 10, 9, 2),
   labelCex=0.7,
   drawBox=FALSE,
   adjPreset=c("topright", "left", "bottomright", "top"),
   txt=c("0-120 degrees,\nangle=-15,\narc.only=TRUE",
      "120-240 degrees,\nangle=-15,\narc.only=TRUE,\nlarger radius",
      "240-360 degrees,\nangle=-15,\narc.only=FALSE",
      "angle=20"))


jmw86069/jamenrich documentation built on Feb. 3, 2024, 12:40 p.m.