Skip to contents

This function merges the possibilities of image and filled.contour, and adds a flexible legend.

Usage

limage(x=1:dim(z)[1],y=1:dim(z)[2],z,smooth=FALSE,
           nlevels=15,levels=pretty(zlim,nlevels),
           color.palette=colorRampPalette(c("blue","white","red")),
           col=color.palette(length(levels)-1), na.col=par("bg"),
           legend=FALSE,legend.cex=.7,
           legend.width=1/12,legend.sep=c(1/4,1/2),
           legend.skip=1,legend.digits=5,
           plot.title,title.adjust=TRUE,
           legend.title,
           asp=1, useRaster=TRUE, ...)

Arguments

x,y

Vectors with regularly spaced co-ordinates.

z

Matrix of data values to be plotted.

smooth

If FALSE, the image consists of the actual grid boxes (cfr. image), if TRUE the values are smoothed (cfr. filled.contour). Note that in the first case, the domain size is extended by half a grid interval in all directions!

asp

Aspect ratio of the axes. Default is 1. In the case of a Lat-Lon map, a warning is issued, because Lat and Lon degrees are not proportional in general.

nlevels, levels

Number of levels (assumed to be evenly distributed) or explicit break points.

color.palette

A color palette to use for the plot.

na.col

Only used if smooth=FALSE. Sets an alternative colour for all NA values.

legend

If TRUE, a legend is added to the right of the image. Note that in this case the title of the image will be off-centre if title.adjust=FALSE.

legend.width

The fraction of the plot region occupied by the xlegend. Must be smaller than 1.

legend.sep

A vector with 2 elements that describes which fraction of the legend width is occupied by the color strip itself. Default is c(1/4,2/4).

legend.cex

The scaling of the legend. Default is 0.6 .

legend.skip

An integer >=1. In the legend, numerical values are given explicitely only with interval legend.skip. If there are many levels, you may want to set it to a larger value.

legend.title, plot.title

These options define the main title and an optional title for the legend. They are not given simply as a character string, but in the form of a title command, e.g. legend.title=title(main="legend"). In this way, you can also have a subtitle etc. and chooose where to write the legend title.

useRaster

A very good option for 'image'. The postscript output is much better. But it may be a problem with other graphical drivers.

col, legend.digits, title.adjust

fine-tuning the plot.

...

Other graphical parameters for e.g. image, ...

Details

There are also shortcuts iview, fcview that go a little further by adding geographical aspects like map boundaries and have different colour defaults.