RegionPlot (or FillingStyle) using hash lines?



Possible Duplicate:
Filling a polygon with a pattern of insets

I have a RegionPlot (and sometimes a regular Plot) where I'd like to shade two different parts of it two different ways. Since the final output will be printed in black and white, I'd really like to do this in an old fashioned way: with hash lines.

I was mainly wondering if there is some built in way to do this without developing it from scratch.


Posted 2012-06-30T19:54:41.050

Reputation: 3 121

Question was closed 2012-06-30T20:20:36.557



For RegionPlot you could use the MeshFunctions option for this, for example

 RegionPlot[Sin[x y] > 0, {x, -Pi, Pi}, {y, -Pi, Pi}, 
  MeshFunctions -> {#1 + #2 &},
  Mesh -> {Range[-2 Pi, 2 Pi, Pi/20]}, PlotStyle -> None],
 RegionPlot[x^2 + y^4 < 2, {x, -Pi, Pi}, {y, -Pi, Pi}, 
  MeshFunctions -> {#1 - #2 &},
  Mesh -> {Range[-Pi, Pi, Pi/20]}, PlotStyle -> None]]

Mathematica graphics


Posted 2012-06-30T19:54:41.050

Reputation: 34 748

1Very nice! Is there a way to get away with only one RegionPlot command? Similar to how PlotStyle accepts a list of specifications for each region being plotted. – Eckhard – 2014-02-03T23:31:50.457

1Thanks and sorry for duplicating a previous post. I looked, but must not have used just the right search terms. – JohnD – 2012-06-30T21:43:54.500

@texas That's okay, they are often not easy to find. We do appreciate your trying however. :-) – Mr.Wizard – 2012-07-01T06:53:08.530