MathGroup Archive 2008

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

Search the Archive

Re: crosshatch shading

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88347] Re: crosshatch shading
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 2 May 2008 03:44:42 -0400 (EDT)
  • References: <fvbr2c$pho$1@smc.vnet.net>

Yes, I think you can. Others may have a better way but here is a method 
using the Presentations package. I use it to hatch the positive lobe of a 
Sin curve. Basically I draw a set of slanted parallel lines and restrict 
their extent with a RegionFunction.

Needs["Presentations`Master`"]

Draw2D[
 {Draw[Sin[x], {x, 0, 2 \[Pi]}],
  Line[{{0, 0}, {2 \[Pi], 0}}],
  GrayLevel[.5],
  Draw[# + .5 x, {x, 0, 2 \[Pi]},
     PlotPoints -> 40,
     RegionFunction -> Function[{x, y, u}, 0 < y < Sin[x]]] & /@
   Range[-1.6, 1, .1]},
 PlotRange -> {-1.1, 1.1},
 Frame -> True]

Here is a method for a stand alone hatched plot without the package.

RegionPlot[0 < y < Sin[x], {x, 0, \[Pi]}, {y, 0, 1},
 ColorFunction -> (White &),
 BoundaryStyle -> Black,
 Mesh -> 30,
 MeshFunctions -> {.5 #1 - #2 &}]

And here is the way to combine RegionPlots with other plot elements using 
Presentations.

Draw2D[
 {Draw[Sin[x], {x, 0, 2 \[Pi]}],
  Line[{{0, 0}, {2 \[Pi], 0}}],
  RegionDraw[0 < y < Sin[x], {x, 0, \[Pi]}, {y, 0, 1},
   ColorFunction -> (White &),
   BoundaryStyle -> Black,
   Mesh -> 30,
   MeshFunctions -> {.5 #1 - #2 &}]},
 PlotRange -> {-1.1, 1.1},
 Frame -> True]

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


<gsi.tim at gmail.com> wrote in message news:fvbr2c$pho$1 at smc.vnet.net...
>I am preparing a graph for publication. I have been able to shade
> various areas in the graph different colors using the Filling option.
> However, for publication the paper will be in black and white. I would
> like to change the shaded areas to be filled in with crosshatches,
> parallel lines, etc. What are the options and commands to do this? I
> have looked online, but have not found an answer.
>
> Thanks in advance.
> 



  • Prev by Date: Re: Re: For help about NSolve
  • Next by Date: Re: partial differential equation of diffusion
  • Previous by thread: Re: Re: crosshatch shading
  • Next by thread: Re: Integral wit Norm function