nudge_polygon_list: Nudge polygon_list

nudge_polygon_listR Documentation

Nudge polygon_list

Description

Nudge polygon_list

Usage

nudge_polygon_list(polygon_list = NULL, nudge = NULL, ...)

Arguments

polygon_list

list object with "x" and "y" elements.

nudge

list whose names are found in names(polygon_list), and whose values are x and y coordinates to be moved.

...

additional arguments are ignored.

rotate_degrees

numeric value in degrees (0, 360) to rotate the polygon_list object and all contained polygons. (Not yet implemented.)

Details

This helper function is intended to take list polygon_list coordinates and "nudge" (move by adding a scalar value to each coordinate) only a subset of polygons identified by name.

Value

object list polygon_list object with "x" and "y" elements.

See Also

Other venndir polygons: bbox_polygon_list(), eulerr_to_polygon_list(), get_largest_polygon_list(), get_venn_polygon_shapes(), intersect_polygon_list(), labelr_polygon_list(), minus_polygon_list(), nudge_polygon_coords(), plot_polygon_list(), polygon_areas(), polygon_circles(), polygon_ellipses(), polygon_list_labelr(), polygon_list_to_xy_list(), rescale_polygon_list(), simple_ellipse(), union_polygon_list(), xy_list_to_polygon_list()

Examples

D <- list(
   x=c(-3, 3, 3, 0, -3),
   y=c(-3, -3, 1.5, 4, 1.5))
E <- list(
   x=c(-3, 3, 3, -3),
   y=c(-3, -3, 3, 3))
DElist <- list(D=D, E=E, DE=list(D=D, E=E))
nudge <- list(D=c(x=0, y=10), E=c(x=0, y=-10), DE=c(x=10, y=0))
new_polygon_list <- nudge_polygon_list(polygon_list=DElist,
   nudge=nudge)
poly_colors <- colorjam::rainbowJam(3, alpha=0.5);
plot_polygon_list(DElist, col=poly_colors)
plot_polygon_list(new_polygon_list, col=poly_colors)

polygon_list <- polygon_ellipses(c(3, 2), c(2, 3),
   xradius=c(1, 4),
   yradius=c(5, 2))
plot_polygon_list(polygon_list,
   col=c("#FF000077", "#FFDD0000"),
   xlim=c(-2, 9));
polygon_list2 <- nudge_polygon_list(polygon_list,
   nudge=list(`2`=c(x=3, y=-2))
)
plot_polygon_list(polygon_list2,
   col=c("#FF000077", "#FFDD0077"),
   add=TRUE,
   xlim=c(-2, 9));

plot_polygon_list(polygon_list[2], border="blue", lty="dotted", lwd=3, add=TRUE);
plot_polygon_list(polygon_list2[2], border="blue", lty="dotted", lwd=3, add=TRUE);
arrows(x0=2, x1=5, y0=3, y1=1)


jmw86069/venndir documentation built on June 15, 2024, 1:52 p.m.