[R] shaded area between a curve and a circle

Jinsong Zhao j@zh@o @end|ng |rom ye@h@net
Sun Oct 23 17:05:29 CEST 2022


The figure is not ok. The coordinate of the normal curve is not the same 
as that of the circle. In fact, there are only four intersections other 
than eight that your figure show.

Best,

Jinsong

On 2022/10/23 3:05, L... L... wrote:
> Dear, I have a picture in which I draw a circle over the standard normal curve. See below the lines used to draw the figure. The figure is ok, but my problem is: How to shade the areas A, B, C, D, E and F? I know I have to find the points of intersection but I don't know how to find them. Suggestions will be welcome.
>
> library(plotrix)
>
> x   <-  seq(-3.0, 3.0, 0.01)
> fy  <-  dnorm(x)
> fy  <-  fy / max(fy)
>
> x11()
> plot(x, fy, ylim = c(-1, 1), col = "white", lwd = 1.5, xlim = c(-3, 3), lty = 1)
> draw.circle(0.0, 0.0, 2.00,  border = 'blue', lty = 1, lwd = 0.8)
>
> lines(x, fy, type = 'l', ylim = c(-1,1), col = 'red', )
> lines(x,-fy, type = 'l', ylim = c(-1,1), col = 'red')
>
> text( 0.0, 0.90, "A"); text( 0.0,-0.90, "B")
> text(-1.8, 0.25, "C"); text( 1.8, 0.25, "D")
> text(-1.8,-0.25, "E"); text( 1.8,-0.25, "F")
>
> Best regards
>
> ML
>
>
>
> ________________________________
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using 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