Prev: Using numbers close to to zero in Mathematica version 6
Next: Surprising behaviour with nested pure functions and local parameter
From: Benjamin Hell on 9 Apr 2010 03:35 Hi, I have a plot with two curves in it. Let's make things simple and say the first one is x[t]:=t and the second one y[t]:=-t+1. Plotting shall be done on the interval [0,1]. So far so good. Now I want to fill in the area in which t < x[t] and t < y[t]. If I use Filling->Axis, of course the area below the whole plot of x[t] and y[t] is filled. The overlapping part is filled in a less transparent color, but that's not what I want. Is there any elegant way to achieve what I want to do? Thanks in advance.
From: Helen Read on 10 Apr 2010 06:51 On 4/9/2010 3:35 AM, Benjamin Hell wrote: > Hi, > I have a plot with two curves in it. Let's make things simple and say > the first one is x[t]:=t and the second one y[t]:=-t+1. Plotting shall > be done on the interval [0,1]. > So far so good. Now I want to fill in the area in which t< x[t] and t< > y[t]. If I use Filling->Axis, of course the area below the whole plot of > x[t] and y[t] is filled. The overlapping part is filled in a less > transparent color, but that's not what I want. Is there any elegant way > to achieve what I want to do? > > Thanks in advance. > I don't think you mean t < x[t] and t < y[t]. This would mean t < t and t < -t + 1 The first inequality is always false, so the region you describe is empty. Do you actually mean to fill the region where y < x and y < -x+1? If that is what you are after, use RegionPlot. f[x_]=x g[x_]=-x+1 RegionPlot[{y < f[x] && y < g[x]}, {x, 0, 1}, {y, 0, 1}] -- Helen Read University of Vermont
From: Bob Hanlon on 10 Apr 2010 06:55
x[t_] = t; y[t_] = -t + 1; Plot[{x[t], y[t], Min[x[t], y[t]]}, {t, 0, 1}, Filling -> {3 -> Axis}] Bob Hanlon ---- Benjamin Hell <hell(a)exoneon.de> wrote: ============= Hi, I have a plot with two curves in it. Let's make things simple and say the first one is x[t]:=t and the second one y[t]:=-t+1. Plotting shall be done on the interval [0,1]. So far so good. Now I want to fill in the area in which t < x[t] and t < y[t]. If I use Filling->Axis, of course the area below the whole plot of x[t] and y[t] is filled. The overlapping part is filled in a less transparent color, but that's not what I want. Is there any elegant way to achieve what I want to do? Thanks in advance. |