Skip to content

Help: add arrows on a filled.contour figure

2 messages · Z Cui, Roger D. Peng

#
Dear All

I would like to use filled.contour to plot something with arrows on it. I did it in this way:

filled.contour(1:nx,1:nz,u,col=gray(rev((0:20/20))))
for (j in zseq ) for (i in xseq) arrows(i, j, i+u[i,j],j+w[i,j],length=angleng,angle=angarrow,code=2, lwd=1,col="black")

The peoblem is that the arrows use the whole device area, including the key on the right hand side of the filled contour. Does anyone know how to work out this problem?

Many thanks for your kind reply.
Dr Zhiqiang Cui
School of Geography and Environmental Sciences
The University of Birmingham
Edgbaston, Birmingham
B15 2TT
#
You need to use the 'plot.axes' argument.  See the help page.

Try this:

filled.contour(1:nx,1:nz,u,col=gray(rev((0:20/20))), plot.axes = { for (j
in zseq ) for (i in xseq)
arrows(i,j,i+u[i,j],j+w[i,j],length=angleng,angle=angarrow,code=2,
lwd=1,col="black") })


-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng
On Wed, 4 Dec 2002, Z Cui wrote: