[R] A contour plot question - vis.gam () function in "mgcv"

ilai keren at math.montana.edu
Wed Apr 4 18:08:33 CEST 2012


On Tue, Apr 3, 2012 at 6:22 PM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
> On 2012-04-03 15:49, ilai wrote:
>>
>> Try to plot the points first followed by vis.gam(...,type='contour',
>> color='bw', add=T) instead of vis.gam followed by points.
>>
>> HTH
>
>
> Or, if vis.gam gives you default scales that you wish to preserve,
> then just replot the contours over the points with
>
>   vis.gam(....., add = TRUE)
>
> Peter Ehlers

I would say no. This works as a quick and dirty but as a general rule,
in my view "replot" should be discouraged because of the reduced print
quality of the visible elements from the original. Maybe a minor
issue, but annoying to give a presentation and realize labels in the
plot are all fuzzy when projected on the big screen (never happened to
me of course, I'm talking about a friend...:). To preserve the scales
in this case would be better to explicit set limits
plot(...,pch=19,xlim,ylim) ; vis.gam(....., add = TRUE)
rather than
vis.gam()
points()
vis.gam()

Cheers
>
>>
>>
>> On Tue, Apr 3, 2012 at 2:48 PM, Ravi Varadhan<rvaradhan at jhmi.edu>  wrote:
>>>
>>> Hi,
>>>
>>> Please see the attached contour plot (I am sorry about the big file).
>>>  This was created using the vis.gam() function in "mgcv" package.  However,
>>> my question is somewhat broader.
>>>
>>> In generating this figure, I first created the contours using vis.gam()
>>> and then I plotted the points.  These point are plotted on top of the
>>> contours so that some of the contour lines are only partially visible.  Is
>>> there a way to make the contour lines fully visible?  I cannot reverse the
>>> order and plot the points first and then call vis.gam().  Or, can I?  Are
>>> there other options?
>>>
>>> Thanks for any help or hints.
>>>
>>> Best,
>>> Ravi
>>>
>>>
>>> Ravi Varadhan, Ph.D.
>>> Assistant Professor
>>> The Center on Aging and Health
>>> Division of Geriatric Medicine&  Gerontology
>>>
>>> Johns Hopkins University
>>> rvaradhan at jhmi.edu<mailto:rvaradhan at jhmi.edu>
>>> 410-502-2619
>>>
>>>
>>> ______________________________________________
>>> 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.
>>>
>>
>> ______________________________________________
>> 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.
>
>



More information about the R-help mailing list