Description Usage Arguments Value Examples
Given a matrix mat
, make a raster plot of the matrix whereby in the
plot, the pixel at x = i
, y = j
has colour based on
the value of mat[i, j]
and the x axis points right and the
y axis points down (see 'Details').
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
mat |
The matrix you wish to plot. |
scale_name |
A string. The title of the color scale on the right of the plot. |
limits |
This gives the user the option to set all values outside a
certain range to their nearest value within that range (if |
ranges |
A numeric vector. If you want specific ranges of values to have
the same color, specify these ranges via an increasing numeric vector. For
example, if you want the ranges 0.5-1.2 and 1.2-3, use
|
range_names |
A character vector. If your colour scale is discrete, here you can set the names which will label each range in the legend. |
colours |
If you have set |
na_colour |
Which colour should the |
clip |
If either |
clip_low |
Setting this to |
clip_high |
Setting this to |
log_trans |
Do you want to log-transform the colour scaling? |
breaks |
Where do you want tick marks to appear on the legend colour scale? |
include_breaks |
If you don't want to specify all the breaks, but you want some specific ones to be included on the legend colour scale, specify those specific ones here. |
In the graphics console, a raster plot (via
ggplot2::geom_raster()
) will appear with the matrix values
represented as pixel colours, with a named scale bar.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | img <- ijtiff::read_tif(system.file("extdata", "50.tif", package = "nandb"))
ijtiff::display(img[, , 1, 1])
matrix_raster_plot(img[, , 1, 1])
b <- brightness(img, def = "B", detrend = FALSE, thresh = "Huang")
matrix_raster_plot(b, scale_name = "brightness")
matrix_raster_plot(b, scale_name = "brightness", log_trans = TRUE)
matrix_raster_plot(b,
scale_name = "brightness", log_trans = TRUE,
include_breaks = 1.35
)
matrix_raster_plot(b,
scale_name = "brightness", log_trans = TRUE,
breaks = 1:3
)
matrix_raster_plot(b,
scale_name = "brightness",
ranges = seq(0.5, 3, length.out = 6),
range_names = paste0(1:5, "mer")
)
matrix_raster_plot(b,
scale_name = "brightness",
ranges = seq(0.5, 3, length.out = 6),
range_names = paste0(1:5, "mer"), log_trans = TRUE
)
matrix_raster_plot(b,
scale_name = "brightness",
include_breaks = 1.25, range_names = NULL,
log_trans = FALSE
)
matrix_raster_plot(b,
scale_name = "brightness",
include_breaks = 1.25, log_trans = TRUE
)
matrix_raster_plot(b,
scale_name = "brightness",
limits = c(1, 1.25), clip = TRUE
)
matrix_raster_plot(b,
scale_name = "brightness",
include_breaks = 1.25
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.