Re: Filling from x_1 to x_2
- To: mathgroup at smc.vnet.net
- Subject: [mg111992] Re: Filling from x_1 to x_2
- From: Helen Read <hpr at together.net>
- Date: Mon, 23 Aug 2010 02:40:36 -0400 (EDT)
- References: <i4r4an$jtc$1@smc.vnet.net>
- Reply-to: HPR <read at math.uvm.edu>
On 8/22/2010 8:14 AM, Anders wrote:
> Hi,
>
> I'm trying to only fill the area under a function from one x-value
> (x_1) to another x-value (x_2) (the purpose is to represent an
> integral with the filling) . I'm using the Filling -> Axis option, but
> I'm not sure how to limit the x-values.
>
> Do you guys know anything about this?
I would make one plot with no Filling on a larger domain, and another
plot with Filling on the interval that you would like filled, then show
the plots together. For example:
f[x_] = x^3 + x + 5
plot1 = Plot[f[x], {x, -3, 3}];
plot2 = Plot[f[x], {x, 1, 2}, Filling -> 0];
Show[{plot1, plot2}]
Sometimes you might need PlotRange->Automatic within Show, and it's also
a good idea to include AxesOrigin->{0,0} when you are using Filling->0
or Filling->Axis.
--
Helen Read
University of Vermont