magimage
is a level replacement for base image with hooks into magaxis for the tick marks and magmap for the image scaling. The default behavious is a bit different to base (e.g. x/y scales are automatically the number of pixels in the image matrix). magimageRGB
is similar, but is for the creation colour images where the user can provide R G B input matrix chanels (or similar).
magimage(x, y, z, zlim, xlim, ylim, col = grey((0:1000)/1000), add = FALSE,
useRaster = TRUE, asp = 1, magmap=TRUE, lo = 0, hi = 1, flip = FALSE, range = c(0, 1),
type = "quan", stretch = "asinh", stretchscale = 'auto', bad = NA, clip = "", axes = TRUE,
frame.plot = TRUE, ...)
magimageRGB(x, y, R, G, B, zlim, xlim, ylim, add = FALSE, useRaster = TRUE, asp = 1,
magmap = TRUE, lo = 0.2, hi = 0.995, flip = FALSE, range = c(0, 1), type = "quan",
stretch = "asinh", stretchscale = "auto", bad = range[1], clip = "", axes = TRUE,
frame.plot = TRUE, ...)
image
). If magmap=TRUE zlim should be with respect to the range output of magmap
. By default the magmap
function scales between 0 and 1, so to only show the brighter pixels zlim could be set to c(0.5,1).
magmap
re-mapping of z to be parsed into (e.g. rainbow
, heat.colors
, topo.colors
, terrain.colors
or similar).
magmap
for more information.
magmap
for more information.
magmap
for more information.
magmap
for more information.
magmap
for more information.
magmap
for more information.
magmap
for more information.
magmap
for more information. For magimageRGB
bad is set to range[1] by default since this removes RGB conversion errors that would be experiences with NA values (i.e. negative values when stretch='log').
magmap
for more information.
magmap
scaling) are shown.
magaxis
. See magaxis
for details.
image
, magmap
and magaxis
for more details.
image
, magmap
, magaxis
#Basic
magimage(matrix(1:9,3))
#Mid pixel versus pixel edge:
magimage(3:0,1:3,matrix(1:9,3))
#Standard scaling is not very useful in this instance:
magimage(matrix(10^(1:9),3))
#Linear scaling is not very useful in this instance, though it does now map from [0,1]:
magimage(matrix(10^(1:9),3),magmap=TRUE,zlim=c(0,0.5))
#Log scaling with magmap makes it much clearer:
magimage(matrix(10^(1:9),3),magmap=TRUE,stretch='log')
#And it's easy just to show the lowest half now:
magimage(matrix(10^(1:9),3),magmap=TRUE,stretch='log',zlim=c(0,0.5))
Run the code above in your browser using DataLab