[R] Unadulterated plot

James Nicolson jlnicolson at gmail.com
Thu Feb 19 17:08:29 CET 2009


To All,

I'm using R 2.8.1. I have attached two images, one shows what I get and
the other shows what I want. All I want is the plotting region. Surely
there must be a way of plotting individual regions/components in R?

Patrizio, I prefer filled.contour() for my data. I still have the same
problem (a legend to the right) if I use image() then contour()!

Regards,
James

ps. No need for apologies Simon :D I'm grateful for any assistance
fruitless or not.


Patrizio Frederic wrote:
> James,
> as I previously told you in my broken  English, probably the function
> you're looking for is not filled.contour but image and contour
> The following code makes exactly what you ask for
>
> data(akima)
> akima
> akima.smooth <-
>  with(akima, interp(x, y, z, xo=seq(0,25, length=500),
>                     yo=seq(0,20, length=500)))
> op <- par(ann=FALSE, mai=c(0,0,0,0))
> image  (akima.smooth, main = "interp(<akima data>, *) on finer grid")
> contour(akima.smooth, add = TRUE,drawlabels=F)
>
> cheers
>
> Patrizio
>
> 2009/2/19 James Nicolson <jlnicolson at gmail.com>:
>   
>> good point! Provide your own set of x,y,z co-ords, mine are pretty big
>> but you can use any.
>>
>> library(akima)
>>
>> fr3d = data.frame(x,y,z)
>> xtrp <- interp(fr3d$x,fr3d$y,fr3d$z,linear=FALSE,extrap=TRUE,duplicate=
>> "strip")
>>
>> op <- par(ann=FALSE, mai=c(0,0,0,0))
>> filled.contour(xtrp$x, xtrp$y, xtrp$z, asp = 0.88402366864, col =
>> rev(rainbow(28,start=0, end=8/12)), n = 40)
>> par(op)
>>
>> I tried all these settings too (none of them made a difference)...
>> usr=c(0,845,0,747), mfcol=c(1,1), mfrow=c(1,1),
>> oma=c(0,0,0,0),omi=c(0,0,0,0), plt=c(1,1,1,1)
>>
>> Regards
>> James
>>
>>
>> Peter Alspach wrote:
>>     
>>> Kia ora James
>>>
>>> I think it would be easier to provide you with help if you "provide
>>> commented, minimal, self-contained, reproducible code" [see bottom of
>>> this, or any, email to R-help].
>>>
>>> Hei kona ra ...
>>>
>>> Peter Alspach
>>>
>>>
>>>       
>>>> -----Original Message-----
>>>> From: r-help-bounces at r-project.org
>>>> [mailto:r-help-bounces at r-project.org] On Behalf Of James Nicolson
>>>> Sent: Thursday, 19 February 2009 11:22 a.m.
>>>> To: r-help at r-project.org
>>>> Subject: Re: [R] Unadulterated plot
>>>>
>>>> Hi,
>>>>
>>>> Thanks for your help. I have looked at the beginners
>>>> documentation and while there are options to configure
>>>> various aspects of the plot none of them seem to have the
>>>> desired effect. I have managed to ensure that the plot fills
>>>> the space vertically with no margins, no axes etc (using
>>>> mai=c(0,0,0,0)). However, horizontally there remains a margin
>>>> to the right that pads the space between the filled.contour
>>>> and its legend.
>>>> I've tried options to par and filled.contour but I can't seem
>>>> to remove the legend.
>>>>
>>>> Kind Regards,
>>>> James
>>>>
>>>> Simon Pickett wrote:
>>>>
>>>>         
>>>>> Hi James,
>>>>>
>>>>> What you really need to do is to check out the many freely
>>>>>
>>>>>           
>>>> available
>>>>
>>>>         
>>>>> pdfs for R beginners. Here is a good place to start
>>>>>
>>>>> http://cran.r-project.org/other-docs.html
>>>>>
>>>>> If I am right interpreting what you want, I think you need
>>>>>
>>>>>           
>>>> to create a
>>>>
>>>>         
>>>>> blank plot with no axes, axis labels etc. Try
>>>>>
>>>>> plot(x,y,xlab="",ylab="",xaxt=NULL,yaxt=NULL,type="n")
>>>>> #blank plot
>>>>> points(x,y)
>>>>>
>>>>> type "?par" into R and see how you can set parameters like
>>>>>
>>>>>           
>>>> this up as
>>>>
>>>>         
>>>>> the default.
>>>>>
>>>>> Hope this helps?
>>>>>
>>>>> Simon.
>>>>>
>>>>>
>>>>> ----- Original Message ----- From: "James Nicolson"
>>>>> <jlnicolson at gmail.com>
>>>>> To: <r-help at r-project.org>
>>>>> Sent: Sunday, February 15, 2009 10:29 PM
>>>>> Subject: [R] Unadulterated plot
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> To all,
>>>>>>
>>>>>> Apologies if this question has already been asked but I can't find
>>>>>> anything. I can't seem to think of more specific search
>>>>>>
>>>>>>             
>>>> terms. I want
>>>>
>>>>         
>>>>>> to display/create a file of a pure plot with a specific height and
>>>>>> width. I want to utilise every single pixel inside the
>>>>>>
>>>>>>             
>>>> axes. I do not
>>>>
>>>>         
>>>>>> want to display any margins, legends, axes, titles or
>>>>>>
>>>>>>             
>>>> spaces around
>>>>
>>>>         
>>>>>> the edges. Is this possible? Additionally, the plot I am
>>>>>>
>>>>>>             
>>>> working with
>>>>
>>>>         
>>>>>> is a filled.contour plot and I can not remove the legend?
>>>>>>
>>>>>>             
>>>> How can I
>>>>
>>>>         
>>>>>> do this?
>>>>>>
>>>>>> Kind Regards,
>>>>>> James
>>>>>>
>>>>>> ______________________________________________
>>>>>> 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.
>>>>
>>>>
>>>>         
>>> The contents of this e-mail are confidential and may be subject to legal privilege.
>>>  If you are not the intended recipient you must not use, disseminate, distribute or
>>>  reproduce all or any part of this e-mail or attachments.  If you have received this
>>>  e-mail in error, please notify the sender and delete all material pertaining to this
>>>  e-mail.  Any opinion or views expressed in this e-mail are those of the individual
>>>  sender and may not represent those of The New Zealand Institute for Plant and
>>>  Food Research Limited.
>>>
>>>
>>>       
>> ______________________________________________
>> 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