[R] Colouring a grid segment

darrenh65 darren.hennessy at advitech.com.au
Fri Oct 9 03:42:00 CEST 2009


I have done some more tinkering this morning. It seems it's the first polar
plot that has the unusual size. If I add a third plot the last two grids
match ok. So I added a further kludge to solve my problem, I added a dummy
plot before the two 'real' plots and this works ok:

polar.plot(0,0,labels='',showgrid=FALSE)
par(new=TRUE)

While it works it's not very elegant. This could use some further
investigation

Darren


Jim Lemon-2 wrote:
> 
> On 10/08/2009 01:15 PM, darrenh65 wrote:
>> Hi,
>> I am attempting to create a polar chart (using plotrix polar.plt) and I
>> need
>> to colour a segment of the grid to indicate an area of interest, say from
>> 90-120 degrees, for arguments sake. Is this possible? I can colour the
>> whole
>> grid by passing the grid.bg parameter through to radial.plot but I cannot
>> find a way to colour a segment.
>>
>> thanks,
>> Darren
>>    
> Hi Darren,
> You're right, there isn't any way to color just one sector of the 
> background in a polar.plot. That's the bad news. The slightly less bad 
> news is that I think you can kludge it by calling polar.plot twice with 
> par(new=TRUE) between. First do the plot without the sector, noting the 
> maximum extent of the grid ("maxlength" in the code). Then plot the 
> polygon by calling the function so:
> 
> polar.plot(c(rep(maxlength,40)),
>   polar.pos=seq(start,end,length.out=40),rp.type="p",...)
> par(new=TRUE)
> 
> (you may want more than 40 points) Then plot your real data on top of 
> this. I can't test this right now, but will try it out in the next day 
> or so.
> 
> Jim
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Colouring-a-grid-segment-tp25797407p25814366.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list