par(mfrow)
or layout
. To plot just a palette,
e.g. to get an x-y plot with points coloured according to a palette, use
drawPalette
and then draw the main diagram.imagep(x, y, z, xlim, ylim, zlim, zclip = FALSE, flipy = FALSE, xlab = "",
ylab = "", zlab = "", zlabPosition = c("top", "side"),
decimate = TRUE, breaks, col, colormap, labels = NULL, at = NULL,
drawContours = FALSE, drawPalette = TRUE, drawTriangles = FALSE,
tformat, drawTimeRange = getOption("oceDrawTimeRange"),
filledContour = FALSE, missingColor = NULL, mgp = getOption("oceMgp"),
mar, mai.palette, xaxs = "i", yaxs = "i", cex = par("cex"), adorn,
axes = TRUE, main = "", axisPalette, debug = getOption("oceDebug"), ...)
z
are defined. In this case, both x
and y
must be supplimage
, which explains the same
descript"histogram"
to have a flattened histogram (i.e. to maximally
increase contrast throughout the domain.)zlim
. This only works if zlim
is
provided. Clipped regions will be coloured with missingColor
.
Thus, clipping an image is somewhat analogous tTRUE
indicating that the image
should be flipped top to bottom (e.g. to produce a profile image
for a downward-looking acoustic-doppler profile).decimate=FALSE
then every grid cell in the matrix will
be represented by a pixel in the image. Case 2 (the default).pretty
, in determining clean break points.oce.colorsJet
for a rainbow.colormap
. If
provided, then colormap$breaks
and colormap$col
take
precedence over the present arguments breaks
and col
.
(All at
).label
s.drawPalette=TRUE
, a palette is drawn at the right-hand side of the
main image. If drawPalette=FALSE
, no palette is drawn, and the
right-hand side of the plot has a thin margdrawPalette
.oce.plot.ts
, for
plot types that call that function. (See strptime
for the
format used.)x
axis is a
time. If TRUE
, then an indication of the time range of the
data (not the axis) is indicated at the top-left margin of the
graph. This is useful because the labels on time axes only indicateNULL
to avoid making the indication.par(mgp)
, and
also for par(mar)
, computed from this. The default is
tighter than the R default, in order to use more space for the
data and less for the axes.par("mar")
. If not
given, a reasonable value is calculated based on whether xlab
and
ylab
are empty strings.mai
value used for the palette. Use with care."i"
) or not; see
par
("xaxs").xaxs
but for y axis.par
("cex").expression
to be performed immediately after
drawing the data panel.TRUE
to get axes on the main image.axis()
, passed to
drawPalette
.xat
and yat
,
values that can be used by oce.grid
to add a grid to the
plot.imagep
is called. RStudio version 0.99.451 (released late in 2015) did
not have this problem, but it appeared in version 0.99.878 (released early
2016). The issue was reported to RStudio in January 2016. The workaround is
simple: open a new (and separate) plotting window with dev.new
.filled.contour
except that with imagep
it is possible to
set the layout
outside the function, which enables the creation
of plots with many image-palette panels. Note that the contour lines may not
coincide with the colour transitions, in the case of coarse images.Note that this does not use layout
or any of the other screen
splitting methods. It simply manipulates margins, and draws two plots
together. This lets users employ their favourite layout schemes.
The palette is drawn before the image, so that further drawing can be done on
the image if desired, if the user prefers not to use the adorn
argument.
NOTE: imagep
is an analogue of image
, and from that
it borrows a the convention that the number of rows in the matrix corresponds to
to x
axis, not the y
axis. (Actually, image
permits
the length of x
to match either nrow(z)
or 1+nrow(z)
, but
here only the first is permitted.)
drawPalette
, and is used by plot.adp
,
plot.landsat
, and other image-generating functions.library(oce)
# 1. simplest use
imagep(volcano)
# 2. something oceanographic (internal-wave speed)
h <- seq(0, 50, length.out=100)
drho <- seq(1, 3, length.out=200)
speed <- outer(h, drho, function(drho, h) sqrt(9.8 * drho * h / 1024))
imagep(h, drho, speed, xlab="Equivalent depth [m]",
ylab=expression(paste(Delta*rho, "[kg/m^3]")),
zlab="Internal-wave speed [m/s]")
# 3. fancy labelling on atan() function
x <- seq(0, 1, 0.01)
y <- seq(0, 1, 0.01)
angle <- outer(x,y,function(x,y) atan2(y,x))
imagep(x, y, angle, filledContour=TRUE, breaks=c(0, pi/4, pi/2),
col=c("lightgray", "darkgray"),
at=c(0, pi/4, pi/2),
labels=c(0, expression(pi/4), expression(pi/2)))
# 4. a colormap case
data(topoWorld)
cm <- colormap(name="gmt_globe")
imagep(topoWorld, colormap=cm)
Run the code above in your browser using DataLab