Re: ContourStyle Question

*To*: mathgroup at smc.vnet.net*Subject*: [mg110578] Re: ContourStyle Question*From*: Maxim <m.r at inbox.ru>*Date*: Sat, 26 Jun 2010 03:11:29 -0400 (EDT)*References*: <hvv4ul$gt$1@smc.vnet.net>

On Jun 24, 3:28 am, Jon <jkpa... at hotmail.com> wrote: > Hi All > > I'd like to plot contour lines consisting of a solid line with short diagonal lines on one side, something like this > > -------------------- <---(solid line along the contour) > ///////////////// <---(short diagonal lines on one side) > > I'm making a plot of experimental data and I want to show that the regionon one side of the contour is allowed while the other side is not. > > I don't want resort to shading the entire region because it is quite a busy figure and the colouring will make it difficult to read. > > Is there a ContourStyle which does this? > If not, can I create my own ContourStyle which can? > > Thanks in advance! > > Jon Probably will need some tweaking for your specific application, but you can do something like this: f[x_, y_] := Cos[x] + Cos[y] - 1/2 Normal@ContourPlot[f[x, y] == 0, {x, 0, 4 Pi}, {y, 0, 4 Pi}] /. Line[pts_, s___] :> Module[{pp = pts[[1 ;; -1 ;; 5]], nv}, nv = Differences[pts][[1 ;; -1 ;; 5]].{{0, 1}, {-1, 0}}; If[Length@nv < Length@pp, pp = Most@pp]; nv *= .25/Sqrt@Total[nv^2, {2}]; nv = pp + Sign[f @@ Transpose[pp + nv]] nv; {Line[pts, s], Gray, Line[Transpose@{pp, nv}]}] Maxim Rytin m.r at inbox.ru