MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: shading in area

  • To: mathgroup at
  • Subject: [mg17021] Re: [mg17004] shading in area
  • From: BobHanlon at
  • Date: Wed, 14 Apr 1999 02:11:44 -0400
  • Sender: owner-wri-mathgroup at

In a message dated 4/10/99 6:51:31 AM, dgrover1 at writes:

>I have a function f[x_] := (x^4-9)/(3x-8) and Plot[f[x], {x,-1,1.5}]; 
>looking for the area from -1 to 1.5 and would like to color in the area
>under the curve from where the function crosses the x-axis to 1.5.  Is
>a command in mathematica that will do this?


f[x_] := (x^4-9)/(3x-8);

Plot[f[x], {x,-1,1.5}]; 

Note that f[x] does not cross the x-axis (y=0).  
The x-axis shown is offset and crosses at y= 1.

With the axes at the origin, the curve looks like

Plot[{f[x], 0}, {x,-1,1.5}]; 

Filled plots are done using the standard package Graphics`FilledPlot`


FilledPlot[f[x], {x, -1, 1.5}];

If you really want the shading above y=1 then use

g[x_] := f[x] /; f[x] < 1;
g[x_] := 1 /; f[x] >= 1;

FilledPlot[{f[x], g[x]}, {x, -1, 1.5}];

FilledPlot[{f[x], g[x], 0}, {x, -1, 1.5}, 
Fills -> {Hue[1/2], RGBColor[1, 1, 1]}];

Bob Hanlon

  • Prev by Date: Re: Problems with Solve
  • Next by Date: Re: Matrix manipulation
  • Previous by thread: shading in area
  • Next by thread: Re: shading in area