zeehio / ggmatrix

ggplot extension for matrices
Other
0 stars 0 forks source link

ggmatrix

Provide a geom able to rasterize matrices faster than geom_raster().

Installation

You can install the development version of ggmatrix from GitHub with:

# install.packages("remotes")
remotes::install_github("zeehio/ggmatrix")

Example

This is a basic example which shows you how to solve a common problem:

library(ggmatrix)
#> Loading required package: ggplot2

x_small <- c(3,5,7,9)
y_small <- c(100,200,300)
mat_small <- matrix(
  seq(from = 1, to = length(x_small)*length(y_small)),
  nrow = length(x_small),
  ncol = length(y_small)
)
dimnames(mat_small) <- list("x label" = x_small, "y label" = y_small)

ggplot() + geom_matrix_raster(matrix = mat_small)