[R] Draw Overlapping Circles with shaded tracks

Jim Lemon drjimlemon at gmail.com
Mon Jan 1 00:16:32 CET 2018


Hi Abou,
Sure:

library(plotrix)
pdf("circles.pdf")
plot(0:10,type="n",axes=FALSE,xlab="",ylab="")
ymult=getYmult()
draw.circle(4,5,radius=3,border="#ff0000aa",lwd=10)
for(angle in seq(0,1.95*pi,by=0.05*pi))
 draw.circle(4+3*cos(angle),5+3*sin(angle)*ymult,
  radius=runif(1,0.05,0.1),col="#00ff00aa")
draw.circle(6,5,radius=3,border="#0000ffaa",lwd=10)
for(angle in seq(0,1.95*pi,by=0.05*pi))
 draw.circle(6+3*cos(angle),5+3*sin(angle)*ymult,
  radius=runif(1,0.05,0.1),col="#ffff00aa")
dev.off()

You're right, it's really ugly.

Thanks John, how could I have forgotten.

Jim

On Mon, Jan 1, 2018 at 1:13 AM, AbouEl-Makarim Aboueissa
<abouelmakarim1962 at gmail.com> wrote:
> Dear All:
>
> Thank you very much for all of you.
>
> I just have one more thing. Is there a way to fill the borders with small
> dots, may be different sizes.
>
> I tried to do it, but it looks ugly.
>
> Here what I tried:
>
>
>
>
> library(plotrix)
>
>
> plot(0:10, 0:10, type="n",axes=FALSE,xlab="",ylab="")   #### 0:5,
>
> draw.circle(4,5,radius=3,border="#ff0000aa", lwd=75)
>
> draw.circle(4,5,radius=2.50,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.55,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.60,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.65,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.70,border="red",lty=3,lwd=3)
>
> draw.circle(4,5,radius=2.75,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.80,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.85,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.90,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=2.95,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.0,border="red",lty=3,lwd=3)
>
> draw.circle(4,5,radius=3.05,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.10,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.15,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.20,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.25,border="red",lty=3,lwd=3)
>
>
> draw.circle(4,5,radius=3.30,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.35,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.40,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.45,border="red",lty=3,lwd=3)
> draw.circle(4,5,radius=3.50,border="red",lty=3,lwd=3)
>
>
>
> draw.circle(7.5,5,radius=3,border="#0000ffaa",lwd=75)
>
>
> draw.circle(7.5,5,radius=2.50,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.55,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.60,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.65,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.70,border="blue",lty=3,lwd=3)
>
> draw.circle(7.5,5,radius=2.75,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.80,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.85,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.90,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=2.95,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.0,border="blue",lty=3,lwd=3)
>
> draw.circle(7.5,5,radius=3.05,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.10,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.15,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.20,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.25,border="blue",lty=3,lwd=3)
>
>
> draw.circle(7.5,5,radius=3.30,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.35,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.40,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.45,border="blue",lty=3,lwd=3)
> draw.circle(7.5,5,radius=3.50,border="blue",lty=3,lwd=3)
>
>
>
> Once again thank you very much
>
> abou
>
> ______________________
>
>
> *AbouEl-Makarim Aboueissa, PhD*
>
> *Professor of Statistics*
>
> *Department of Mathematics and Statistics*
> *University of Southern Maine*
>
>
> On Sun, Dec 31, 2017 at 8:40 AM, Marc Girondot via R-help <
> r-help at r-project.org> wrote:
>
>> Another solution:
>>
>> library("HelpersMG") plot(0:10,type="n",axes=FALSE,xlab="",ylab="",
>> asp=1) ellipse(center.x = 3, center.y = 5, radius.x = 5, radius.y = 5,
>> lwd=10, col=NA, border=rgb(red = 1, green = 0, blue=0, alpha = 0.5))
>> ellipse(center.x = 8, center.y = 5, radius.x = 5, radius.y = 5, lwd=10,
>> col=NA, border=rgb(red = 0, green = 1, blue=0, alpha = 0.5))
>>
>>
>> (Without the graphic example, it is difficult to know what tit was
>> supposed to do !)
>>
>> Marc
>>
>> Le 31/12/2017 à 14:10, John Kane via R-help a écrit :
>> > That code nees the plotrix package:
>> > library(plotrix)
>> > pdf("circles.pdf")
>> > plot(0:10,type="n",axes=FALSE,xlab="",ylab="")
>> > draw.circle(4,5,radius=3,border="#ff0000aa",lwd=10)
>> > draw.circle(6,5,radius=3,border="#0000ffaa",lwd=10)
>> > dev.off()
>> >
>> >
>> >
>> >
>> >      On Friday, December 29, 2017, 6:06:32 PM EST, Jim Lemon <
>> drjimlemon at gmail.com> wrote:
>> >
>> >   Hi Abou,
>> > Without an illustration it's hard to work out what you want. here is a
>> > simple example of two circles using semi-transparency. Is this any
>> > help?
>> >
>> > pdf("circles.pdf")
>> > plot(0:10,type="n",axes=FALSE,xlab="",ylab="")
>> > draw.circle(4,5,radius=3,border="#ff0000aa",lwd=10)
>> > draw.circle(6,5,radius=3,border="#0000ffaa",lwd=10)
>> > dev.off()
>> >
>> > Jim
>> >
>> > On Fri, Dec 29, 2017 at 9:45 PM, AbouEl-Makarim Aboueissa
>> > <abouelmakarim1962 at gmail.com> wrote:
>> >> Dear All:
>> >>
>> >>
>> >> I am wondering if there is a way in R to draw these two circles with
>> shaded
>> >> tracks in both circles using R, and make both circles uncovered. I am
>> >> trying to make it in MS words, but I could not. Your help will be highly
>> >> appreciated.
>> >>
>> >>
>> >> In my previous post I added the image of the two circles, but the post
>> >> never published. I just thought to resent the post again without the
>> image.
>> >>
>> >> with many thanks
>> >> abou
>> >> ______________________
>> >>
>> >>
>> >> *AbouEl-Makarim Aboueissa, PhD*
>> >>
>> >> *Professor of Statistics*
>> >>
>> >> *Department of Mathematics and Statistics*
>> >> *University of Southern Maine*
>> >>
>> >>          [[alternative HTML version deleted]]
>> >>
>> >> ______________________________________________
>> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> >> 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 -- To UNSUBSCRIBE and more, see
>> > 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.
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > 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.
>>
>>
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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