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

library(ggmultiglyph)
library(grid)
library(gridExtra)

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Whisker and contour combination
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15)

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     whisker = FALSE)

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     contour = FALSE)

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 0, angle.stop = base::pi)

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     whisker = FALSE,
                     angle.start = 0, angle.stop = base::pi)

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     contour = FALSE,
                     angle.start = 0, angle.stop = base::pi)

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust size
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 10)

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15)

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 20)

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 10,
                     angle.start = 0, angle.stop = base::pi)

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 0, angle.stop = base::pi)

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 20,
                     angle.start = 0, angle.stop = base::pi)

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 10,
                     whisker = FALSE)

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     whisker = FALSE)

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 20,
                     whisker = FALSE)

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 10,
                     whisker = FALSE,
                     angle.start = 0, angle.stop = base::pi)

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     whisker = FALSE,
                     angle.start = 0, angle.stop = base::pi)

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 20,
                     whisker = FALSE,
                     angle.start = 0, angle.stop = base::pi)

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)




sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 10,
                     contour = FALSE)

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     contour = FALSE)

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 20,
                     contour = FALSE)

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 10,
                     contour = FALSE,
                     angle.start = 0, angle.stop = base::pi)

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     contour = FALSE,
                     angle.start = 0, angle.stop = base::pi)

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 20,
                     contour = FALSE,
                     angle.start = 0, angle.stop = base::pi)

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust angle
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15)

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 0, angle.stop = base::pi)

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 90 * (base::pi/180),
                     angle.stop = 270 * (base::pi/180))

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 2 * base::pi,
                     angle.stop = 0)

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = base::pi, angle.stop = 0)

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 270 * (base::pi/180),
                     angle.stop = 90 * (base::pi/180))

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust whisker and contour line width
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15)

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     lwd.whisker = 3, lwd.contour = 0.1)

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     lwd.whisker = 0.1, lwd.contour = 3)

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 0, angle.stop = base::pi)

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

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

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust fill colour
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     fill = "salmon")

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

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

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

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

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

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust whisker and contour colour
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     col.whisker = "salmon", col.contour = "salmon")

sg2 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     lwd.whisker = 3, lwd.contour = 0.1,
                     col.whisker = "cyan", col.contour = "gray")

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     lwd.whisker = 0.1, lwd.contour = 3,
                     col.whisker = "gray", col.contour = "green")

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     angle.start = 0, angle.stop = base::pi,
                     col.whisker = "salmon", col.contour = "salmon")

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     lwd.whisker = 3, lwd.contour = 0.1,
                     angle.start = 0, angle.stop = base::pi,
                     col.whisker = "cyan", col.contour = "gray")

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     lwd.whisker = 0.1, lwd.contour = 3,
                     angle.start = 0, angle.stop = base::pi,
                     col.whisker = "gray", col.contour = "green")

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Multivariate whisker colour
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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

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

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

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     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 = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.24, 0.3, 0.8, 1.4, 0.6, 0.33), size = 15,
                     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.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust line join style
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 15,
                     lwd.contour = 10)

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

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

grid.arrange(sg1, sg2, sg3, nrow = 1, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust line end style
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(0.28, 0.33, 0.8, 1.2, 0.6, 0.5, 0.7), size = 15,
                     lwd.whisker = 10, contour = FALSE)

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

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

grid.arrange(sg1, sg2, sg3, nrow = 1, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust grid levels
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Grid levels
gl <- split(x = c(rep(c(1, 2, 3), 4),
                  rep(c(1, 2, 3, 4), 2)),
            f = c(rep(1:4, each = 3),
                  rep(5:6, each = 4)))
gl
#> $`1`
#> [1] 1 2 3
#> 
#> $`2`
#> [1] 1 2 3
#> 
#> $`3`
#> [1] 1 2 3
#> 
#> $`4`
#> [1] 1 2 3
#> 
#> $`5`
#> [1] 1 2 3 4
#> 
#> $`6`
#> [1] 1 2 3 4
#> 

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     draw.grid = TRUE, grid.levels = gl,
                     grid.point.size = 0.01)

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

sg3 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.contour = 3,
                     draw.grid = FALSE, grid.levels = gl,
                     grid.point.size = 0.05,
                     whisker = FALSE)

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = TRUE, grid.levels = gl,
                     grid.point.size = 0.01)

sg5 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     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 = 0.05, contour = FALSE)

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     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.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Adjust fill, whisker, contour and grid level colours
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sg1 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     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",
                     grid.point.size = 0.05)

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

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

sg4 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = TRUE, grid.levels = gl,
                     grid.point.size = 0.01)

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

sg6 <- starglyphGrob(x = unit(0.5, "npc"), y = unit(0.5, "npc"),
                     z = c(1, 3, 2, 1, 2, 3), size = 5,
                     lwd.contour = 3,
                     whisker = FALSE,
                     angle.start = 0, angle.stop = base::pi,
                     draw.grid = FALSE, grid.levels = gl,
                     col.whisker = RColorBrewer::brewer.pal(6, "Dark2"),
                     grid.point.size = 0.05)

grid.arrange(sg1, sg2, sg3, sg4, sg5, sg6, nrow = 2, ncol = 3)