MathGroup Archive 2003

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

Search the Archive

Re: filled plot on part of x-interval

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44625] Re: [mg44599] filled plot on part of x-interval
  • From: "Bruce W. Colletti" <bcolletti at compuserve.com>
  • Date: Tue, 18 Nov 2003 06:41:55 -0500 (EST)
  • References: <200311170838.DAA01205@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Murray

The notebook below points to a solution.  Run it and then modify to suit.

Bruce

Needs["Statistics`"];
Needs["Graphics`FilledPlot`"];
Clear[jpdf, m, f, x, y];
jpdf = PDF[NormalDistribution[2, 1], x];

f[y_] := (jpdf /. x -> y) /; 1 <= y <= 3
f[y_] := 0 /; y < 1 || y > 3

m[y_] := (jpdf /. x -> y) /; y < 1 || y > 3
m[y_] := 0 /; 1 <= y <= 3

SetOptions[FilledPlot, DisplayFunction -> Identity, 
Ticks -> {Range[-1, 6], None}, Axes -> {True, False}, 
Fills -> GrayLevel[0.7], PlotRange -> {0, f[2]}];

(* remember : FilledPlot shades region between curves *)

g = FilledPlot[{f[x], jpdf}, {x, -1, 6}]; 
h = FilledPlot[{m[x], jpdf}, {x, -1, 6}]; 

xlabel = TableForm[
Map[StyleForm[#, FontFamily -> "Arial", FontWeight -> "Bold", 
FontSize -> 12] &, {"Centered Line 1", "Centered Line 2"}], 
TableAlignments -> Center];

Show[GraphicsArray@{h, g}, Frame -> True, PlotLabel -> xlabel, 
ImageSize -> {300, 100}];

----- Original Message ----- 
From: "Murray Eisenberg" <murray at math.umass.edu>
To: mathgroup at smc.vnet.net
Subject: [mg44625] [mg44599] filled plot on part of x-interval


> How do I use a FilledPlot that fills the region under the graph of f[x] 
> only, say, for x from 2 to 10 but still graphs the function itself from 
> 0 to 10?


  • Prev by Date: Re: Improper integral
  • Next by Date: Re: plotting streamlines from vector data
  • Previous by thread: Re: filled plot on part of x-interval
  • Next by thread: Re: filled plot on part of x-interval