You should probably say more about which graphics engine you are using, but here's a start:
curve(x^2-4, from = -3, to = 3) x <- seq(-3, 3, length.out = 200) polygon(c(x, rev(x)), c(x^2-4, rep(Inf, length(x))), col = 2) The red is a little "oppressive" so I'd try to add transparency if your device supports it. Adding a shade above/below argument to curve based on the same principles might be a fun exercise too... Michael On Thu, Feb 16, 2012 at 9:13 AM, AbouEl-Makarim Aboueissa <[email protected]> wrote: > Dear all R Users: > > How can I shade the solution (-Inf,-2) or (2,Inf) of the inequality -x^2+4<0 > within the curve of f(x)=-x^2+4. > > and > > the solution (-Inf,-2)or(2,Inf) of the inequality x^2-4>0 within the curve of > f(x)=x^2-4. > > > with many thanks > > abou > > > ========================== > AbouEl-Makarim Aboueissa, Ph.D. > Associate Professor of Statistics > Graduate Program Coordinator > Department of Mathematics & Statistics > University of Southern Maine > 96 Falmouth Street > P.O. Box 9300 > Portland, ME 04104-9300 > USA > > > Tel: (207) 228-8389 > Fax: (207) 780-5607 > Email: [email protected] > [email protected] > > Office: 301C Payson Smith > > > [[alternative HTML version deleted]] > > _______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-teaching _______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-teaching
