MyNixOS website logo
Description

Readable String Abbreviation.

Strings are abbreviated to at least "minlength" characters, such that they remain unique (if they were). The abbreviations should be recognisable.

plot.matrix

Visualizes a matrix object plainly as heatmap. It provides a

  • single S3 function plot for matrices,
  • function assignColors which assigns a specific color to each value of a vector, and
  • specific functions for loadings, correlation and p-values matrices.

View the vignette on GitHub or after installing with

library("plot.matrix")
vignette("plot.matrix") 

Installation

From CRAN

install.packages("plot.matrix")

From github

Note that from github you install the current development version.

library("devtools")
install_github("sigbertklinke/plot.matrix")

Examples

plot.matrix

# you may need to adjust the margin sizes
library("plot.matrix")
par(mar=c(5.1, 4.1, 4.1, 4.1)) # default c(5.1, 4.1, 4.1, 2.1)
# numeric matrix
x <- matrix(runif(50), nrow=10)
plot(x)
plot(x, key=NULL)
plot(x, key=list(cex.axis=0.5, tick=FALSE))
plot(x, digits=3)
plot(x, breaks=c(0,1), digits=3, cex=0.6)
# logical matrix
m <- matrix(runif(50)<0.5, nrow=10)
plot(m)
plot(m, key=NULL, digits=1)
# character matrix
s <- matrix(sample(letters[1:10], 50, replace=TRUE), nrow=10)
plot(s)
plot(s, digits=10)
plot(s, digits=10, col=heat.colors(5), breaks=letters[1:5])

plot.loadings

# factor analysis
library("psych")
data <- na.omit(bfi[,1:25]))
#
fa1 <- factanal(data, 5)
plot(loadings(fa1))
#
fa2 <- fa(data, 5) # psych::fa
plot(loadings(fa2))
# principal component analysis
library("psych")
data <- na.omit(bfi[,1:25]))
# 
pa <- princomp(data)
plot(loadings(pa), digits=NA) # no numbers
#
pa <- prcomp(data)
ld <- structure(pa$rotation, class="loadings")
plot(ld, digits=NA)

assignColors

# numeric vector
assignColors(runif(50))
# logical vector
assignColors(runif(50)<0.5) 
# character vector
assignColors(sample(letters[1:10], 50, replace=TRUE))

History

  • 2021-04-26 Added spacing.key, Rmd-fying help, version 1.6
  • 2020-11-10 Added two examples for using plot results
  • 2020-11-01 Version 1.5.2 cleaned documentation
  • 2020-10-01 Version 1.5.0 added invisible return for plot.matrix
  • 2019-12-06 Version 1.4
  • 2019-12-05 Extended treatment for NAs, sorting for loadings matrices changed
  • 2019-09-16 Math annotation for plot bug(?)
  • 2019-07-09 Added further data sets, gray scale support, text color change
  • 2019-07-03 Added bfi data set, Version 1.2
  • 2019-05-13 Version 1.1
  • 2019-05-10 plot.loadings, error in y-axis labelling
  • 2018-12-20 Vignette, assignColors
  • 2018-12-01 Added examples for tables, extended formatting possibilities
  • 2018-11-27 Version 1.0
Metadata

Version

0.1

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows