drawPalette(zlim, zlab="", breaks, col,
mai=c(0, 1/8, 0, 3/8), top=0, bottom=0,
drawContours=FALSE, debug=getOption("oceDebug"), ...)
oceColorsJet
for a rainbow.par
.TRUE
to get contours on the
palette, at the colour breaks.mai
instead of top
and
bottom
; the latter arguments will be delete very soon, and without
notice!drawPalette
draws an image palette near the
right-hand side of the plotting device, and then adjusts the global margin
settings in such a way as to cause the next plot to appear to the left of
the palette. The function can also be used, if zlim
is not provided,
to adjust the margin without drawing anything; this is useful in lining up
the x axes of a stack of plots, some some of which will have palettes and
others not.
Note that the plot positioning is done entirely with margins, not with
par(mfrow)
or other R schemes for multi-panel plots. This means
that the user is free to use those schemes without worrying about nesting
or conflicts; see see imagep
.par(mgp=getOption("oceMgp"))
par(mar=c(3,3,1,1))
par(mfrow=c(4,1))
drawPalette(zlim=c(0,1),col=oceColorsJet(5))
plot(1:5, 1:5, col=oceColorsJet(5)[1:5],pch=20,cex=5,xlab='x', ylab='y', main='test 1')
## put space for palette to right of next graph (so x scales line up in stacked plot)
drawPalette()
plot(1:10, 1:10, col=oceColorsPalette(10)[1:10],pch=20,cex=5,xlab='x', ylab='y', main='test 2')
drawPalette(zlim=c(0,1),zlab="Image Scale",col=oceColorsPalette)
plot(1:10, 1:10, lwd=2, bg=oceColorsPalette(10)[1:10],pch=21,cex=5,col='black',xlab='x', ylab='y', main='test 3')
drawPalette(zlab="Image Scale")
plot(1:10, 1:10, col=oceColorsPalette(10)[1:10],pch=20,cex=5,xlab='x', ylab='y', main='test 4')
Run the code above in your browser using DataLab