[R] shaded area between a curve and a circle

L... L... m@r@|@m@ck @end|ng |rom hotm@||@com
Sat Oct 22 21:05:45 CEST 2022


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]]



More information about the R-help mailing list