[R-sig-teaching] Shading the solution of quadratic inequality

2012-02-16 Thread AbouEl-Makarim Aboueissa
Dear all R Users: How can I shade the solution (-Inf,-2) or (2,Inf) of the inequality -x^2+40 within the curve of f(x)=-x^2+4. and the solution (-Inf,-2)or(2,Inf) of the inequality x^2-40 within the curve of f(x)=x^2-4. with many thanks abou ==

Re: [R-sig-teaching] Shading the solution of quadratic inequality

2012-02-16 Thread R. Michael Weylandt
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

Re: [R-sig-teaching] Shading the solution of quadratic inequality

2012-02-16 Thread Randall Pruim
I'm not sure exactly what sort of plot was desired, but I'll offer 1.5 possibilities. Currently you can do something like this: require(mosaic) plotFun( x^2 - 4 ~ x , xlim=c(-6,6), col='blue' ) plotFun( (x^2 - 4)/as.numeric(x^2 -4 0) ~ x , xlim=c(-6,-2), add=TRUE, col='blue', lwd=4 ) It

Re: [R-sig-teaching] Shading the solution of quadratic inequality

2012-02-16 Thread Randall Pruim
The xlim=c(-6,-2) is extraneous in the code below. It snuck in from something else I was doing. It doesn't hurt any, but it doesn't do anything either since the plotting limits are inferred from the surrounding plot when add=TRUE is used. On Feb 16, 2012, at 10:07 AM, Randall Pruim

[R-sig-teaching] Shading the solution of quadratic inequality

2012-02-15 Thread AbouEl-Makarim Aboueissa
Dear all R Users: How can I shade the solution (-Inf,-2) or (2,Inf) of the inequality -x^2+40 within the curve of -x^2+4=0. and the solution (-Inf,-2)or(2,Inf) of the inequality x^2-40 within the curve of x^2-4=0. with many thanks abou == AbouEl-Makarim