plot_glyphs: Plot glyphs

Description Usage Arguments Author(s) Examples

View source: R/plot_glyphs.R

Description

plot_glyphs plots a list of glyphs by basic plot or the plot in "grid" package

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
plot_glyphs(
  x,
  y = NULL,
  glyphs,
  glyphWidth,
  glyphHeight,
  just = c("centre", "center", "top", "bottom", "left", "right", "bottomleft",
    "topright", "bottomright", "topleft"),
  type = c("raster", "pixmap", "grid"),
  add = FALSE,
  xlab = "x",
  ylab = "y",
  xlim = NULL,
  ylim = NULL,
  ...
)

Arguments

x

a numeric vector specifying x-location or a matrix whose first column specify x-location and second column specify y-location

y

a numeric vector specifying y-location, if x is a matrix, y is NULL.

glyphs

a list of glyphs which are data matrices in picture format or pixmaps

glyphWidth

width of each glyph

glyphHeight

height of each glyph

just

the justification of the rectangle relative to its (x, y) location

type

string specifying the format used to plot. "raster" means each glyph in the list is a data matrix in the png, jpeg or tiff format, and "pixmap" means it is a class of pixmap. "grid" means it will be ploted by the way in "grid" package. See rasterImage, pixmap, grid.raster

add

logical value, indicate whether the plot is add on to the original plot or not

...

Arguments passed to plot if add=FALSE

Author(s)

Jiahua Liu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(dplyr)
# ozone
data_ozone <- list()
for(i in 1:(24*24)){
  col_number <- (i-1) %% 24 + 1
  row_number <- (i-1) %/% 24 + 1
  data_ozone[[i]] <- as.vector(nasa$mets$ozone[col_number,row_number,,])
}
glyphs_ozone <- make_glyphs(data = data_ozone, width = c(1,12,1), height = c(1,1,6),
                            glyph_type = "Keim", type = "pixmap")
x <- getGridXY(length(glyphs_ozone))
plot_glyphs(x, glyphs = glyphs_ozone, type = "pixmap")
# rainbow color
glyphs_rainbow <- make_glyphs(data = data_temperature[1:25], width = c(1,12,1), height = c(1,1,6), cols = rainbow(3),
                              glyph_type = "Keim")
x <- getGridXY(length(glyphs_rainbow))
x[,1] <- x[,1]/ceiling(max(x[,1]))
x[,2] <- x[,2]/ceiling(max(x[,2]))
plot_glyphs(x, glyphs = glyphs_rainbow, type = "grid")

rwoldford/glyphs documentation built on Nov. 14, 2020, 2:29 a.m.