Re: [R] Draw Polygon with a Circular Side

From: ermimi <ermimi__at_hotmail.com>
Date: Tue, 20 May 2008 10:37:24 -0700 (PDT)

Thank you very much Jim for you help!!Your help was my need!! I have create this function to draw a polygon with a circular side

 DrawPortion<-function(init,finish,length_){

  	plot(0,xlim=c(-10,10),ylim=c(-10,10),xlab="",ylab="",type="n",axes=TRUE)
        
       
polygon(c(0,length_*cos(seq(ToRadians(finish),ToRadians(init),length.out=50))),
       
c(0,length_*sin(seq(ToRadians(finish),ToRadians(init),length.out=50))),
        border="#ffaaaa",col="#66ee33") 
       }


ToRadians<-function(grades){
	radians=(grades/180*pi);
	return(radians);
	}
		

Thank you very much Jim

A Greetings Luismi

Jim Lemon-2 wrote:
>
> ermimi wrote:

>> Hello Friends!!!
>> 
>> I would want draw a circular histogram, and I would like draw a polygon
>> with
>> a circular side. This is easy if I use the functions polygon and arc, but
>> I
>> want that the polygon with a circular side have background colour. The
>> polygon created with function polygon can have background colour, but the
>> surface created with function arc canĀ“t have background colour.
>> How I could create a polygon with a circular side that have background
>> colour?? 
>> Thank you very much,  
>> A greetings Luismi

>
> Hi Luismi,
> The phrase "circular histogram" brings to mind something like a wind
> rose. There are a few you could try:
>
> windrose in the oce and circular packages
>
> rosavent in the climatol package
>
> oz.windrose in the plotrix package
>
> and perhaps rose in the IDPmisc package
>
> Now about this "polygon with a circular side". I think you mean the
> standard issue polygon like a rectangle except that one side is a
> circular arc instead of a straight line. If this bold conjecture is
> correct, here is an example for you:
>
> plot(0,xlim=c(-1,1),ylim=c(-1,1),xlab="",ylab="",
> type="n",axes=FALSE)
> polygon(c(0,-1,-1,0,cos(seq(pi/2,0,length.out=50)),
> cos(seq(2*pi,3*pi/2,length.out=50))),c(-1,-1,1,1,
> sin(seq(pi/2,0,length.out=50)),sin(seq(2*pi,3*pi/2,length.out=50))),
> border="#ffaaaa",col="#66ee33")
>
> 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/Draw-Polygon-with-a-Circular-Side-tp17328921p17346192.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.
Received on Tue 20 May 2008 - 18:02:51 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 20 May 2008 - 18:30:38 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive