tileglyphGrob: Draw a Tile Glyph

View source: R/tileglyphGrob.R

tileglyphGrobR Documentation

Draw a Tile Glyph

Description

Uses Grid graphics to draw a tile glyph similar to 'autoglyph' \insertCitebeddow_shape_1990gglyph or 'stripe glyph' \insertCitefuchs_evaluation_2013gglyph.

Usage

tileglyphGrob(
  x = 0.5,
  y = 0.5,
  z,
  size = 10,
  ratio = 1,
  nrow = 1,
  col = "black",
  fill = NA,
  lwd = 1,
  alpha = 1,
  linejoin = c("mitre", "round", "bevel")
)

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 values to be plotted as dimensions in the tileglyph.

size

The size of glyphs.

ratio

The aspect ratio (height / width).

nrow

The number of rows.

col

The line colour.

fill

The fill colour.

lwd

The line width.

alpha

The alpha transparency value.

linejoin

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

Value

A grob object.

References

\insertAllCited

See Also

geom_tileglyph

Other grobs: dotglyphGrob(), metroglyphGrob(), pieglyphGrob(), profileglyphGrob(), starglyphGrob()

Examples

tg1 <- tileglyphGrob(x = 150, y = 150,
                   z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                   size = 5)

tg2 <- tileglyphGrob(x = 450, y = 150,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 5)

tg3 <- tileglyphGrob(x = 150, y = 250,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 5, nrow = 2)

tg4 <- tileglyphGrob(x = 450, y = 250,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 5, nrow = 2)

tg5 <- tileglyphGrob(x = 150, y = 350,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 5,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

tg6 <- tileglyphGrob(x = 450, y = 350,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 5,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

tg7 <- tileglyphGrob(x = 150, y = 450,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 5, nrow = 2,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

tg8 <- tileglyphGrob(x = 450, y = 450,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 5, nrow = 2,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

grid::grid.newpage()
grid::grid.draw(tg1)
grid::grid.draw(tg2)
grid::grid.draw(tg3)
grid::grid.draw(tg4)
grid::grid.draw(tg5)
grid::grid.draw(tg6)
grid::grid.draw(tg7)
grid::grid.draw(tg8)

tg1 <- tileglyphGrob(x = 150, y = 150,
                   z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                   size = 2, ratio = 6)

tg2 <- tileglyphGrob(x = 450, y = 150,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 2, ratio = 6)

tg3 <- tileglyphGrob(x = 150, y = 300,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 2, nrow = 2, ratio = 6)

tg4 <- tileglyphGrob(x = 450, y = 300,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 2, nrow = 2, ratio = 6)

tg5 <- tileglyphGrob(x = 150, y = 450,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 2, ratio = 6,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

tg6 <- tileglyphGrob(x = 450, y = 450,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 2, ratio = 6,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

tg7 <- tileglyphGrob(x = 150, y = 600,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 2, nrow = 2, ratio = 6,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

tg8 <- tileglyphGrob(x = 450, y = 600,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7),
                     size = 2, nrow = 2, ratio = 6,
                     fill = RColorBrewer::brewer.pal(7, "Dark2"))

grid::grid.newpage()
grid::grid.draw(tg1)
grid::grid.draw(tg2)
grid::grid.draw(tg3)
grid::grid.draw(tg4)
grid::grid.draw(tg5)
grid::grid.draw(tg6)
grid::grid.draw(tg7)
grid::grid.draw(tg8)

tg1 <- tileglyphGrob(x = 150, y = 150,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 5, nrow = 2, lwd = 5)

tg2 <- tileglyphGrob(x = 300, y = 300,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 5, nrow = 2, lwd = 5,
                     linejoin = "round")

tg3 <- tileglyphGrob(x = 450, y = 450,
                     z = c(4, 3.5, 2.7, 6.8, 3.4, 5.7, 4.3),
                     size = 5, nrow = 2, lwd = 5,
                     linejoin = "bevel")


grid::grid.newpage()
grid::grid.draw(tg1)
grid::grid.draw(tg2)
grid::grid.draw(tg3)


aravind-j/gglyph documentation built on Aug. 2, 2022, 12:30 a.m.