[R] Filled contour plot showing labeled isolines?

David Winsemius dwinsemius at comcast.net
Wed Nov 24 19:31:51 CET 2010


On Nov 24, 2010, at 10:19 AM, jt306 wrote:

>
> Sorry, I guess I didn't make it clear.  I mentioned it in the  
> subject of my
> post, but not in the body.  Is it possible to have a filled contour  
> plot
> (showing the colors) with the isolines labeled?
>

Then levelplot _was_ (perhaps) the right answer.

levelplot(as.matrix(dfrm), contour=TRUE, labels=TRUE)

>
>
> On Wed, Nov 24, 2010 at 5:35 AM, David Winsemius [via R] <
> ml-node+3057276-1726133352-203184 at n4.nabble.com<ml-node%2B3057276-1726133352-203184 at n4.nabble.com 
> >
>> wrote:
>
>>
>> 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 <[hidden email]<http://user/SendEmail.jtp?type=node&node=3057276&i=0 
>>> >
>>>> 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
>>
>> ______________________________________________
>> [hidden email] <http://user/SendEmail.jtp? 
>> type=node&node=3057276&i=1>mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>> ------------------------------
>> View message @
>> http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3057276.html
>>
>> To unsubscribe from Filled contour plot showing labeled isolines?,  
>> click
>> here<http://r.789695.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=3056437&code=am9uLnRhbmdAZ21haWwuY29tfDMwNTY0Mzd8LTE2NTI0ODgyODg= 
>> >.
>>
>>
>
> -- 
> View this message in context: http://r.789695.n4.nabble.com/Filled-contour-plot-showing-labeled-isolines-tp3056437p3057487.html
> Sent from the R help mailing list archive at Nabble.com.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list