hexagonMap: Plot a pointy toped hexagon and a map of hexagons

Description Usage Arguments Value Author(s) Examples

View source: R/hexagonMap.R

Description

hexagonPT plots a pointy topped hexagon.
hexagonMap plots a map of hexagons.

Usage

1
2
3
4
5
hexagonMap(x, y, col = NA, border = "black", r = NULL, l = NULL,
  add = FALSE, ...)

hexagonPT(x, y, col = NA, border = "black", r = 0.5, l = r/cos(pi/6),
  ...)

Arguments

x, y

hexagon center coordinates.

col

the color for filling the polygon. The default, NA, is to leave polygons unfilled, unless density is specified. (For back-compatibility, NULL is equivalent to NA.) If density is specified with a positive value this gives the color of the shading lines.

border

the color to draw the border. The default, NULL, means to use par("fg"). Use border = NA to omit borders.

For compatibility with S, border can also be logical, in which case FALSE is equivalent to NA (borders omitted) and TRUE is equivalent to NULL (use the foreground colour),

r

radius of circle inscribed in hexagon. Default value is 0.5.

l

distance from the center to the upper/lower vertices of hexagon.

add

logical. If FALSE, a new plot is drawn. If TRUE, plot is drawn on a current graph.

...

graphical parameters such as xpd, lend, ljoin and lmitre can be given as arguments.

Value

Plotted hexagon

Author(s)

Vilmantas Gegzna

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
data <- class::somgrid(8,6,"hexagonal")$pts
head(data)
x <- data[,"x"]
y <- data[,"y"]

hexagonMap(x, y)


hexagonMap(x, y, col = "yellow")


hexagonMap(x, y,
     col = c("tomato1","skyblue","orange"),
     border = c("red", "black"))

text(x,y,1:length(x))
title("Hexagonal cells \n with cell ID number")


#====================================================================
plot.new()
hexagonPT(.5,.5, r = .25)

#====================================================================

GegznaV/kohonen.hexagons documentation built on May 6, 2019, 5:36 p.m.