plotimage: Plotting an image

Description Usage Arguments Value Examples

View source: R/plotimage.R

Description

Plots an image with its colorscale.

Usage

1
plotimage(mat,lim=NULL,nc=1000,m=NULL,z=FALSE,add=FALSE,cols="rainbow",lc=c(0,0.7),p="l")

Arguments

mat

matrix representing the image. Thus, a numerous matrix with 256 rows and 256 columns will represent an image with 256*256 pixels. The colour of each pixel will be determined thanks to the value of the related pixel in the matrix, and the values of the limit scales.

lim

minimum and maximum value for the color scale. Ex: lim=c(0,10)

nc

number of colors

m

boolean matrix with the same size than mat, selecting pixels which will plotted (TRUE) or not (FALSE) (mask)

z

TRUE when mat is a zone matrix stemming from img.zone

add

when TRUE, the graph is drawn over the existing graph. If FALSE, a new graph is plotted.

cols

"rainbow" by default, but other scales are also available : ""gray.scale","cm.colors","topo.colors","terraincors","heat.colors". These scales correspond to the usual colors scales in R.

lc

c(0,0.7) by default. Parameter corresponding to the start color and the end color in the rainbow scale,a number in [0,1] (start in rainbow function)

p

Further parameters to plot. if "n", nothing more is plotted, if "a", axes are plotted, if "l", color legend is plotted, if "al" axes and color legend are plotted. If "d" is added to this parameter (giving "ad","ld","ald" or "nd", no smoothing of the pixel is computed (discrete)

Value

Returns the created image as a cimg (type cimg from the imager package)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(lifetime)
data(count)
data(gp) 
count.img=plotimage(mat=count,lim=c(0,5000))

# with m
count.img=plotimage(mat=count,lim=c(1000,4000),m=count>1000)
plotimage(mat=lifetime,lim=c(2.8,3.5))
gp.img=plotimage(mat=gp,lim=c(-0.2,0.8))

#add

resT=plotimage(mat=lifetime,lim=c(2.8,3.5),m=count>1000)
resGP=plotimage(mat=gp,lim=c(2.8,3.5),add=TRUE)

multifluo documentation built on May 2, 2019, 1:07 p.m.