Skip to contents

Uses Grid graphics to draw a star glyph (Siegel et al. 1972; Chambers et al. 1983; duToit et al. 1986) .

Usage

starglyphGrob(
  x = 0.5,
  y = 0.5,
  z,
  size = 1,
  col.whisker = "black",
  col.contour = "black",
  col.points = "black",
  fill = NA,
  lwd.whisker = 1,
  lwd.contour = 1,
  alpha = 1,
  angle.start = 0,
  angle.stop = 2 * base::pi,
  whisker = TRUE,
  contour = TRUE,
  linejoin = c("mitre", "round", "bevel"),
  lineend = c("round", "butt", "square"),
  grid.levels = NULL,
  draw.grid = FALSE,
  grid.point.size = 10
)

Arguments

x

A numeric vector or unit object specifying x-locations.

y

A numeric vector or unit object specifying y-locations.

z

A numeric vector specifying the distance of star glyph points from the centre.

size

The size of glyphs.

col.whisker

The colour of whiskers.

col.contour

The colour of contours.

col.points

The colour of grid points.

fill

The fill colour.

lwd.whisker

The whisker line width.

lwd.contour

The contour line width.

alpha

The alpha transparency value.

angle.start

The start angle for the glyph in radians. Default is zero.

angle.stop

The stop angle for the glyph in radians. Default is \(2\pi\).

whisker

logical. If TRUE, plots the star glyph whiskers.

contour

logical. If TRUE, plots the star glyph contours.

linejoin

The line join style for the contour polygon. Either "mitre", "round" or "bevel".

lineend

The line end style for the whisker lines. Either "round", "butt" or "square".

grid.levels

A list of grid levels (as vectors) corresponding to the values in z at which points are to be plotted. The values in z should be present in the list specified.

draw.grid

logical. If TRUE, grid points are plotted along the whiskers. Default is FALSE.

grid.point.size

The size of the grid points in native units.

Value

A gTree object.

References

Chambers JM, Cleveland WS, Kleiner B, Tukey PA (1983). Graphical Methods for Data Analysis. Chapman and Hall/CRC, Boca Raton. ISBN 978-1-351-07230-4.

duToit SHC, Steyn AGW, Stumpf RH (1986). Graphical Exploratory Data Analysis, Springer Texts in Statistics. Springer-Verlag, New York. ISBN 978-1-4612-9371-2.

Siegel JH, Farrell EJ, Goldwyn RM, Friedman HP (1972). “The surgical implications of physiologic patterns in myocardial infarction shock.” Surgery, 72(1), 126--141.

Examples

sg1 <- starglyphGrob(x = 400, y = 150,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25)

sg2 <- starglyphGrob(x = 400, y = 400,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 3,
                     lwd.contour = 0.1)

sg3 <- starglyphGrob(x = 400, y = 650,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 0.1,
                     lwd.contour = 3)

sg4 <- starglyphGrob(x = 800, y = 300,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     angle.start = 0, angle.stop = base::pi)

sg5 <- starglyphGrob(x = 800, y = 550,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 3,
                     lwd.contour = 0.1,
                     angle.start = 0, angle.stop = base::pi)

sg6 <- starglyphGrob(x = 800, y = 800,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 0.1,
                     lwd.contour = 3,
                     angle.start = 0, angle.stop = base::pi)

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)
grid::grid.draw(sg4)
grid::grid.draw(sg5)
grid::grid.draw(sg6)


sg1 <- starglyphGrob(x = 400, y = 150,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     fill = "salmon")

sg2 <- starglyphGrob(x = 400, y = 400,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 3,
                     lwd.contour = 0.1,
                     fill = "cyan")

sg3 <- starglyphGrob(x = 400, y = 650,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 0.1,
                     lwd.contour = 3,
                     fill = "green")

sg4 <- starglyphGrob(x = 800, y = 300,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     angle.start = 0, angle.stop = base::pi,
                     fill = "salmon")

sg5 <- starglyphGrob(x = 800, y = 550,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 3,
                     lwd.contour = 0.1,
                     angle.start = 0, angle.stop = base::pi,
                     fill = "cyan")

sg6 <- starglyphGrob(x = 800, y = 800,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 0.1,
                     lwd.contour = 3,
                     angle.start = 0, angle.stop = base::pi,
                     fill = "green")

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)
grid::grid.draw(sg4)
grid::grid.draw(sg5)
grid::grid.draw(sg6)


sg1 <- starglyphGrob(x = 400, y = 150,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     col.contour = "gray")

sg2 <- starglyphGrob(x = 400, y = 400,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 3,
                     lwd.contour = 0.1,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     col.contour = "gray")

sg3 <- starglyphGrob(x = 400, y = 650,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 0.1,
                     lwd.contour = 3,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     col.contour = "gray")

sg4 <- starglyphGrob(x = 800, y = 300,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     angle.start = 0, angle.stop = base::pi,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     col.contour = "gray")

sg5 <- starglyphGrob(x = 800, y = 550,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 3,
                     lwd.contour = 0.1,
                     angle.start = 0, angle.stop = base::pi,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     col.contour = "gray")

sg6 <- starglyphGrob(x = 800, y = 800,
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 25,
                     lwd.whisker = 0.1,
                     lwd.contour = 3,
                     angle.start = 0, angle.stop = base::pi,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     col.contour = "gray")

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)
grid::grid.draw(sg4)
grid::grid.draw(sg5)
grid::grid.draw(sg6)


sg1 <- starglyphGrob(x = 300, y = 250,
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 25,
                     lwd.contour = 10)

sg2 <- starglyphGrob(x = 600, y = 300,
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 25,
                     lwd.contour = 10, linejoin = "bevel")

sg3 <- starglyphGrob(x = 900, y = 350,
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 25,
                     lwd.contour = 10, linejoin = "round")

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)


sg1 <- starglyphGrob(x = 300, y = 250,
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 25,
                     lwd.whisker = 10, contour = FALSE)

sg2 <- starglyphGrob(x = 600, y = 300,
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 25,
                     lwd.whisker = 10, lineend = "butt", contour = FALSE)

sg3 <- starglyphGrob(x = 900, y = 350,
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 25,
                     lwd.whisker = 10, lineend = "square", contour = FALSE)

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)


gl <- split(x = rep(c(1, 2, 3), 6),
            f = rep(1:6, each = 3))

sg1 <- starglyphGrob(x = 150, y = 150,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     draw.grid = TRUE, grid.levels = gl)

sg2 <- starglyphGrob(x = 150, y = 400,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.whisker = 3, col.points = "white",
                     draw.grid = TRUE, grid.levels = gl,
                     contour = FALSE)

sg3 <- starglyphGrob(x = 150, y = 650,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.contour = 3,
                     draw.grid = FALSE, grid.levels = gl,
                     whisker = FALSE)

sg4 <- starglyphGrob(x = 600, y = 150,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = TRUE, grid.levels = gl)

sg5 <- starglyphGrob(x = 600, y = 400,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.whisker = 3,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = TRUE, grid.levels = gl,
                     grid.point.size = 20, contour = FALSE)

sg6 <- starglyphGrob(x = 600, y = 650,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.contour = 3,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = FALSE, grid.levels = gl,
                     whisker = FALSE)

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)
grid::grid.draw(sg4)
grid::grid.draw(sg5)
grid::grid.draw(sg6)


gl <- split(x = rep(c(1, 2, 3), 6),
            f = rep(1:6, each = 3))

sg1 <- starglyphGrob(x = 150, y = 150,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     draw.grid = TRUE, grid.levels = gl,
                     col.points = NA, fill = "black")

sg2 <- starglyphGrob(x = 150, y = 400,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.whisker = 3,
                     draw.grid = TRUE, grid.levels = gl,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     contour = FALSE)

sg3 <- starglyphGrob(x = 150, y = 650,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.contour = 3,
                     draw.grid = FALSE, grid.levels = gl,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     whisker = FALSE)

sg4 <- starglyphGrob(x = 600, y = 150,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     col.contour = "gray",
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = TRUE, grid.levels = gl,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     grid.point.size = 10, col.points = "gray")

sg5 <- starglyphGrob(x = 600, y = 400,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.whisker = 3,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = TRUE, grid.levels = gl,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     grid.point.size = 20, col.points = NA,
                     contour = FALSE)

sg6 <- starglyphGrob(x = 600, y = 650,
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.contour = 3,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = FALSE, grid.levels = gl,
                     whisker = FALSE)

grid::grid.newpage()
grid::grid.draw(sg1)
grid::grid.draw(sg2)
grid::grid.draw(sg3)
grid::grid.draw(sg4)
grid::grid.draw(sg5)
grid::grid.draw(sg6)