How can I make hatching filling of plot

12

2

How can I make hatching filling of plot

Like this:

hatching filling plot

I use another one plot with shifting to make filled area above:

plot := ListLinePlot[
  Table[{x1[w], x2[w]}, {w, 1.5, 5, .005}],     
  Filling -> Top,
  FillingStyle -> White
  ]

fill := ListLinePlot[
  Table[{x1[w] - 0.01, x2[w] - 0.02}, {w, 1.5, 5, .005}],
  Filling -> Top,
  FillingStyle -> LightGray,
  PlotStyle -> LightGray
  ]

Show[fill, plot]

plot

How can I make hatching filling of fill-plot?

shed

Posted 2012-10-24T18:13:11.787

Reputation: 155

Answers

19

Something like this?

    RegionPlot[y < 1/x && y + 0.3 > 1/(x + 0.3) , {x, 0, 3}, {y, 0, 4}, 
  AxesOrigin -> {0, 0}, Frame -> False, Axes -> Automatic, Mesh -> 20,
   MeshFunctions -> {#1 - #2 &}, BoundaryStyle -> None]~Show~
 Plot[1/x, {x, 0, 3}]

Mathematica graphics

You can add PlotStyle -> Transparent to the RegionPlot if you don't want the blue filling, and xkcdify it

enter image description here

Rojo

Posted 2012-10-24T18:13:11.787

Reputation: 40 993

1@shed you probably should accept this one, or you are still hoping for something different? – Rojo – 2013-12-09T22:13:11.573

Beware! The anti-xkcdification patrol is here! http://mathematica.stackexchange.com/a/13359/193

– Dr. belisarius – 2012-10-24T22:12:05.830

1@belisarius, oh, but it very much fits the context. I'll defend it as if it was Howgartz against any evil wizard – Rojo – 2012-10-25T01:39:46.153

+1 for the "evil wizard" ... but your adjectives are too harsh! – Dr. belisarius – 2012-10-25T01:49:17.827

5You may always sweeten the answer by throwing in some infix notation. – Yves Klett – 2012-10-25T12:33:24.510

One more question. I get hatches, but I can't combine it with main plot. I used: Show[ RegionPlot[x1[w] > x2[g] && (x1[w + 0.2]) < (x2[g + 0.2]), {w, 1.5, 5}, {g, 1.5, 5}, AxesOrigin -> {0, 0}, Axes -> Automatic, PlotStyle -> Transparent, Frame -> False, Mesh -> 20, BoundaryStyle -> None, MeshFunctions -> {#1 - #2 &} ], ParametricPlot[{x1[w], x2[w]}, {w, 1.5, 5}] ] I'd tried ListLinePlot, ParametricPlot and both orders. But it's show only the first plot. Also, I tried another RegionPlot, but I don't think that is good way. Which way is better? – shed – 2012-10-26T11:43:36.857

@shed, it should show both, but that ParametricPlot isn't describing the borders of your region. Are you sure that's what you want to plot? Probably there's a scaling issue – Rojo – 2012-10-26T13:42:53.197

1@shed, if you want to plot the borders of that region, I'd go with ContourPlot[x1[w] == x2[g], {w, 1.5, 5}, {g, 1.5, 5}] – Rojo – 2012-10-26T13:55:38.147