Re: 2D-Plot Colorings

*To*: mathgroup at smc.vnet.net*Subject*: [mg54236] Re: [mg54218] 2D-Plot Colorings*From*: "David Park" <djmp at earthlink.net>*Date*: Mon, 14 Feb 2005 00:57:52 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

Bruce, You could do it this way... << Graphics`Graphics` << Graphics`Colors` DisplayTogether[ Plot[x^2, {x, -1, 0.2}, PlotStyle -> Blue], Plot[x^2, {x, 0.2, 0.4}, PlotStyle -> Red], Plot[x^2, {x, 0.4, 1}, PlotStyle -> Blue], Frame -> True, Background -> Linen, ImageSize -> 400]; or DisplayTogether[ MapThread[ Plot[x^2, Evaluate[{x, Sequence @@ #2}], PlotStyle :> #1] &, {{Blue, Red, Blue}, {{-1, 0.2}, {0.2, 0.4}, {0.4, 1}}}], Frame -> True, Background -> Linen, ImageSize -> 400]; With DrawGraphics you could use... Needs["DrawGraphics`DrawingMaster`"] Draw2D[ {Blue, Draw[x^2, {x, -1, 0.2}], Draw[x^2, {x, 0.4, 1}], Red, Draw[x^2, {x, 0.2, 0.4}]}, Frame -> True, Background -> Linen, ImageSize -> 400]; or Draw2D[ {MapThread[{#1, Draw[x^2, Evaluate[{x, Sequence @@ #2}]]} &, {{Blue, Red, Blue}, {{-1, 0.2}, {0.2, 0.4}, {0.4, 1}}}]}, Frame -> True, Background -> Linen, ImageSize -> 400]; I don't think there is anyway around drawing the separate segments. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Bruce Colletti [mailto:vze269bv at verizon.net] To: mathgroup at smc.vnet.net Re Mathematica 5.1. In plotting y = x^2 over [-1,1], I want to color red those points whose y-values are in [0.2, 0.4]. All others are blue. Although I can do this by manipulating the FullGraphics object or by displaying separate plots, is there an easier way via some Plot option? ColorFunction doesn't seem to work (probably user error), and neither does the Plot3D convention in which shading is co-declared with the function. Thankx. Bruce