labelr_JamPolygon: Define label positions for JamPolygon using polylabelr::poi()

labelr_JamPolygonR Documentation

Define label positions for JamPolygon using polylabelr::poi()

Description

Define label positions for JamPolygon using polylabelr::poi()

Usage

labelr_JamPolygon(
  jp,
  precision = 1,
  add_to_jp = FALSE,
  subset_multipart = TRUE,
  ...
)

Arguments

jp

JamPolygon

precision

numeric passed to polylabelr::poi(), default 1.

add_to_jp

logical default FALSE, indicating whether to add "label_x","label_y" into jp@polygons for persistence.

subset_multipart

logical default TRUE, whether to subset multipart polygons to label the largest area.

...

additional arguments are ignored.

Details

This function is a simple wrapper for polylabelr::poi(), which recognizes holes inside polygons.

Todo:

  • Consider basic support for non-overlapping label positions.

    1. First pass might be to use non-overlapping regions of a polygon among a set of polygons.

    2. Second pass would be to use the region with fewest overlaps among other polygons in the set, to define the label position. This rule could serve to solve (1) as well.

Value

matrix with columns "x", "y", "dist"

See Also

Other JamPolygon: JamPolygon-class, Venndir-class, [,JamPolygon,ANY,ANY,ANY-method, add_orientation_JamPolygon(), area_JamPolygon(), bbox_JamPolygon(), buffer_JamPolygon(), check_JamPolygon(), check_Venndir(), eulerr_to_JamPolygon(), farthest_point_JamPolygon(), find_venn_overlaps_JamPolygon(), has_point_in_JamPolygon(), intersect_JamPolygon(), label_fill_JamPolygon(), label_outside_JamPolygon(), label_segment_JamPolygon(), minus_JamPolygon(), nearest_point_JamPolygon(), nudge_JamPolygon(), plot.JamPolygon(), point_in_JamPolygon(), polyclip_to_JamPolygon(), polygon_circles(), polygon_ellipses(), sample_JamPolygon(), split_JamPolygon(), union_JamPolygon(), update_JamPolygon()

Examples

df3 <- data.frame(name=c("polygon1", "polygon2"),
label=c("polygon A", "polygon B"),
x=I(list(
   list(c(1, 6, 6, 1),
      c(2, 5, 5, 2),
      c(3, 4, 4, 3)),
   list(
      c(12, 15, 15, 12) - 3,
      c(13, 14, 14, 13) - 3)
)),
y=I(list(
   list(c(1, 1, 6, 6),
      c(2, 2, 5, 5),
      c(3, 3, 4, 4)),
   list(
      c(2, 2, 5, 5),
      c(3, 3, 4, 4))
)),
fill=jamba::alpha2col(c("gold", "firebrick"), alpha=0.7))
jp3 <- new("JamPolygon", polygons=df3);
plot(jp3);


jmw86069/venndir documentation built on Dec. 14, 2024, 2:36 p.m.