RE: Re: filled plot on part of x-interval

*To*: mathgroup at smc.vnet.net*Subject*: [mg44699] RE: [mg44664] Re: filled plot on part of x-interval*From*: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>*Date*: Fri, 21 Nov 2003 05:13:21 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

>-----Original Message----- >From: AES/newspost [mailto:siegman at stanford.edu] To: mathgroup at smc.vnet.net >Sent: Thursday, November 20, 2003 9:16 AM >To: mathgroup at smc.vnet.net >Subject: [mg44699] [mg44664] Re: filled plot on part of x-interval > > >I'll still assert that something like: > > Needs["Graphics`Graphics`"]; > Needs["Graphics`Colors`"]; > Needs["Graphics`FilledPlot`"]; > > DisplayTogether[ > FilledPlot[{Sin[x], Sin[x]}, {x,2,8}], > Plot[Sin[x], {x,0,10}, PlotStyle->Red]]; > >is clear, simple, flexible, and readable -- and allows you to easily >modify the styles (linewidths, colors) of the different components of >the plot independently, as done here, and add additional stuff if you >like. > >DisplayTogether is your friend -- haven't run into a headache with it >yet. > Dear Professor Siegman, my principal objection is illustrated by the (exaggerated) example: DisplayTogether[ FilledPlot[Sin[x], {x, 2, 8}, Fills -> {{{1, Axis}, Yellow}}, PlotPoints -> 5, PlotDivision -> 2], Plot[Sin[x], {x, 0, 10}, PlotStyle -> Red, PlotPoints -> 5, PlotDivision -> 2]]; Compare this to: filled = FilledPlot[Sin[t], {t, 2, 8}, Fills -> Yellow, PlotStyle -> Red, PlotPoints -> 5, PlotDivision -> 2, DisplayFunction -> Identity]; plow = Plot[Sin[t], {t, 0, 2}, PlotStyle -> Red, PlotPoints -> 2, PlotDivision -> 2, DisplayFunction -> Identity]; plhi = Plot[Sin[t], {t, 8, 10}, PlotStyle -> Red, PlotPoints -> 2, PlotDivision -> 2, DisplayFunction -> Identity]; Show[plow, filled, plhi, DisplayFunction -> $DisplayFunction, AxesFront -> True]; This effectively also is David Park proposal (packend in a convenient, yet non standard interface) My "cute" Theta, however, turns out to be flawed differently, as seen by: \[Theta]1[t_, {min_, max_}] := 1 /; t < min || t > max \[Theta]2[t_, {min_, max_}] := 1 /; min <= t <= max \[Theta][t_, {min_, max_}] := Through[{\[Theta]1, \[Theta]2}[t, {min, max}]] Off[Plot::"plnr"] FilledPlot[Sin[t]*\[Theta][t, {2, 8}], {t, 0, 10}, Fills -> {{{2, Axis}, Yellow}}, PlotStyle -> Red, PlotPoints -> 5, PlotDivision -> 2, PlotRange -> All] Because t=2 and t=8 are not (necessarily) sampled, but enforcing that makes theta superfluous, Sorry. -- Hartmut Wolf