Re: FilledPlot Question
- To: mathgroup at smc.vnet.net
- Subject: [mg39058] Re: FilledPlot Question
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Sun, 26 Jan 2003 05:23:18 -0500 (EST)
- References: <b0tetq$9hu$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
"Matthew Senn" <msenn77 at yahoo.com> wrote in message news:b0tetq$9hu$1 at smc.vnet.net... > i'm relatively new using mathematica 4.2. the other day, i came across what > seemed to be a simple problem, but i couldn't figure out how to do it. > > say i was plotting y=x^2, and i wanted to shade the region under the graph > only between x=2 to x=4 over a range of {x, 0, 5}, is there a way to do > this? i tried FilledPlot, but it filled the entire area under the graph. > > thank you! > > > Matthew, Two suggestions: << Graphics`FilledPlot` FilledPlot[{x^2, If[2 <= x <= 4, 0, x^2]}, {x, 0, 5}]; Below, I use Off[Plot::"plnr"] to suppress messages complaining of non-real values. Off[Plot::plnr] FilledPlot[{x^2, If[2 <= x <= 4, 0]}, {x, 0, 5}] On[Plot::plnr] Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565