[R] contourplot:how to get it to label all contours like 'contour'

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jul 27 09:30:10 CEST 2003

On Sun, 27 Jul 2003 adiamond at fas.harvard.edu wrote:

> Hi,
> one of the nice things about contour is that it labels all contour lines.
> contourplot only labels each particular elevation a single time.
> i.e., if there are two contour lines corresponding to z = 45, it will only 
> label one of them.
> is there a way to get contourplot to automatically label all the contour lines, 
> even those that are repeated?
> i ask because i want to plot contour plots *w/ all contours labelled*, next to  
> wireframe plots-- i can plot two lattice plots (wireframe and contourplot)
> next to each other easily enough, but contourplot doesn't label all contours.
> AND, i can get contour to label all of 'em, but then i don't know how to put 
> an 'Old Style' contour plot alongside the lattice wireframe.
> mfrow doesn't work for wireframe, & i can't "print" plots generated by contour.

What are you doing with the plot?  If including in a document, it is
should be easy to include them as two subfigures (it is LaTeX).  If you
want to do this on one on-screen device it isn't actually that hard: use
print.trellis() to put the wireframe() one where you want it, and use
par(fin) to select a figure region and call contour() within that.  I've
done that sort of thing several times when I wanted overlapping figure
regions, usually because wireframe() gave too large margins.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list