# [R] Filled contour plot showing labeled isolines?

David Winsemius dwinsemius at comcast.net
Wed Nov 24 14:33:50 CET 2010

```On Nov 24, 2010, at 1:48 AM, Jon Tang wrote:

> Thanks for your reply.  My data is a 2D matrix of values:
>
>      A0.1 A0.2 A0.3 A0.4 A0.5 A0.6 A0.7 A0.8 A0.9 A1.0
> P0.1 0.00 0.07 0.07 0.07 0.15 0.11 0.28 0.32 0.62 0.94
> P0.2 0.01 0.00 0.04 0.05 0.04 0.04 0.07 0.13 0.32 0.69
> P0.3 0.01 0.00 0.00 0.02 0.00 0.04 0.02 0.05 0.08 0.50
> P0.4 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.01 0.06 0.31
> P0.5 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.14
>

I was wrong about the name of lattice function that would do that
(although it is on  ont the same help page.) It's contourplot rather
than levelplot. Assume you read this in and the data.frame name is df:

require(lattice)
contourplot(as.matrix(df))

I have failed at getting more labels in the region where teh values
are higher. Here is one of my efforts:

contourplot(as.matrix(df[, 1:10]), at=c(0.1,0.2,0.3, 0.6, 0.9),
label.style="align")

--
David.

>
>
> On Tue, Nov 23, 2010 at 6:46 PM, David Winsemius <dwinsemius at comcast.net
> > wrote:
>
> On Nov 23, 2010, at 6:25 PM, jt306 wrote:
>
>
> Is it possible to create a contour plot with the isolines labeled.
> I know
> you can do this with Matlab.  Argh!
>
> It is fairly straightforward with lattice::levelplot. Provide some
> sample data.
>
>
> I tried creating a filled contour plot, then using par(new=T),
> followed by
> overlaying the contour plot on top.  However, the placement of the
> filled
> contour plot and the contour plot do not align correctly. Any
> suggestions
> would be appreciated.
>
> Thanks,
> Jon
>
> --
>
> David Winsemius, MD
> West Hartford, CT
>
>

David Winsemius, MD
West Hartford, CT

```