nos.image: nos.image text-based image plot.

Description Usage Arguments Note Author(s) See Also Examples

View source: R/NostalgiR.R

Description

Produces a text-based image plot for the visualization of three-dimensional data that are stored in a matrix.

Usage

1
2
3
4
nos.image(data, xmin = 1, xmax = dim(data)[1], ymin = 1,
  ymax = dim(data)[2], xlab = NULL, ylab = NULL, ratio = 0.35,
  width = round(options()$width * 0.8), height = round(ratio * width),
  pch = c(".", "o", "x", "X", "#"))

Arguments

data

A numeric matrix of data to be plotted. NA and NaN are allowed, but are removed for the plot. Infinities will cause an error.

xmin

A numeric value indicating the smallest x-axis value, which corresponds to the first row of data.

xmax

A numeric value indicating the greatest x-axis value, which corresponds to the last row of data.

ymin

A numeric value indicating the smallest y-axis value, which corresponds to the first column of data.

ymax

A numeric value indicating the greatest y-axis value, which corresponds to the last column of data.

xlab

Label of the x-axis of the plot.

ylab

Label of the y-axis of the plot.

ratio

Coefficient that controls the aspect ratio of the plot.

width

Width of the plot in points.

height

Height of the plot in points.

pch

A vector of single-character symbols. The length of the vector determines the number of bins that the data is partitioned into. From left to right, the symbols represent an increasing order of binned.

Note

Due to rounding to a relatively crude grid results can only be approximate. The equally spaced axis ticks, for example, may be non-equally spaced in the plot. Further, due to the crude grid also there might be several points per character. The function uses the same plotting symbol no matter how many points coincide on one character position. The bins are equally spaced between the minimum and the maximum value of the data matrix, and are produced using the hist function. The legend reports the smallest and largest value of each bin associated with each plot symbol.

Author(s)

Hien D. Nguyen

See Also

hist, image, volcano, and txtplot.

Examples

1
2
3
4
5
6
7
## Produce the image plot of the volcano dataset, using the default plotting symbols.
library(datasets)
nos.image(volcano)

## Produce the image plot of the volcano dataset, using the plotting symbols 1:9.
library(datasets)
nos.image(volcano,pch=1:9)

Example output

Loading required package: txtplot
   +-+------------+-----------+------------+------------+------+
   |  .......................................................  |
80 +  ..................oo...................................  +
   |  ........oooooooooxxoooooo..............................  |
   |  .....ooooooxxxxxxxxxxxxooooooooo.......................  |
   |  .....oooxxxxXXXX##XXXXxxxooooooooo.....................  |
   |  ..ooooxxxXXX#########XXxxxooooooooooooooo..............  |
60 +  ..ooxxxXXX###########XXxxxxxoooooxxxxxxoooo............  +
   |  .ooxxxxXX#####XXXXXXXXXXXxxxxxxxxxxxxxxoooo............  |
   |  .ooxxXXX######XXXxxXXXXXXXXxxxxxxxxxxxooooooo..........  |
   |  .ooxxXXX######XXXxxXXXXXXXXXXXXXXxxxxxxxoooooooo.......  |
40 +  ..ooxxXXX######XXXXXXX###XXXXXXXXxxxxxxxxooooooo.......  +
   |  ..oooxxXX################XXXXXXXXXXxxxxxxxxooooo.......  |
   |  ...ooxxXXX#########XXXXXXXXXXXXXXXXxxxxxxxxxxoo........  |
   |  ....oooxXXXXXX##XXXXXxxxxxxxxxxxxxxxxxxxxxxxxoo........  |
20 +  .....oooxxxxXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxooo........  +
   |  .......oooooxxxxxxxxxooooooooooooooxxxxxxoooooo........  |
   |  .......oooooxxxxxxxooooooooooooooooooooooooooo.........  |
   |  ........ooooooxxxooooooo..ooooooooooooooooooo..........  |
 0 +  .........oooooooooo............oo.....ooooooo..........  +
   +-+------------+-----------+------------+------------+------+
     0           20          40           60           80       
Legend: 
. ~ (94,114); o ~ (114,134); x ~ (134,155); X ~ (155,175); # ~ (
175,195)
   +-+------------+-----------+------------+------------+------+
   |  1112222111112212222222222222211111111111111111111111111  |
80 +  1122222222222222222222222222211111111111111111111111111  +
   |  2222222222233444444444332222222222221111111111111111111  |
   |  2222233334455555666555443333332222222111111111111111111  |
   |  2222233445566777888776654433333332222222211111111111111  |
   |  2223344556778888888887765444333433334433222211111111111  |
60 +  2234555667889988888887765544444444455544332222111111111  +
   |  2344556778999987777777766655555555555544433222221111111  |
   |  2344567789999877656667777666555555555444433322222211111  |
   |  2244567789999877666667788766666665555444443333322222211  |
40 +  2233466778999988777778888877777766655555544333332222221  +
   |  2233455778999998888888888877777766665555554443332222211  |
   |  1122345677888898888777777766677766665555555544321111111  |
   |  1122334566777788877666665555555666555555555543321111111  |
20 +  1122233445666677766655555555555555555555555543321111111  +
   |  1111222334445556655544433333444444444444444433322111111  |
   |  1111222233344455554443333333333333333333333332221111111  |
   |  1112222223334444444332222223333333323333333332211111111  |
 0 +  1111222223333334333222222222222222222222233322211111111  +
   +-+------------+-----------+------------+------------+------+
     0           20          40           60           80       
Legend: 
1 ~ (94,105); 2 ~ (105,116); 3 ~ (116,128); 4 ~ (128,139); 5 ~ (
139,150); 6 ~ (150,161); 7 ~ (161,173); 8 ~ (173,184); 9 ~ (184,
195)

NostalgiR documentation built on May 2, 2019, 2:45 p.m.