Message Boards Message Boards

Black & white hash filling under curves

Posted 13 years ago
My paper with Mathematica-created plots was submitted to a journal.
They say I need to fill under a curve with something that shows well
when printed in black and white.  Can I use lines or dots?
POSTED BY: Bruce Miller
This is not built-in, but is straight-forward to add using the RegionPlot function.

=====
Filling with Lines

Step one : create the two curves to be plotted together.
ps=Plot[Sin,{x,0,2Pi},AspectRatio->Automatic,PlotStyle->Black]
pc=Plot[Cos,{x,0,2Pi},AspectRatio->Automatic,PlotStyle->Black]

Step two: use RegionPlot to create horizontal and vertical lines that fill the area between the curves and the x axis.
The Mesh->n option gives the number of mesh lines, horizontal or vertical.   
PlotStyle->None turns off coloring the region that RegionPlot derives.
MeshStyle controls orientation (horizontal vs. vertical).
rps=RegionPlot[ 0<=x<=2Pi && Abs<=Abs[Sin] && If[Sin>0,y>0,y<0], {x,0,2 Pi},{y,-1,1},
       Mesh->12,MeshStyle->{None,Gray},BoundaryStyle->None,PlotStyle->None,AspectRatio->Automatic]
rpc=RegionPlot[ 0<=x<=2Pi&&Abs<=Abs[Cos]&&If[Cos>0,y>0,y<0], {x,0,2 Pi},{y,-1,1},
       Mesh->24,MeshStyle->{Gray,None},BoundaryStyle->None,PlotStyle->None,AspectRatio->Automatic]

Step three: Combine them.  The overlap areas have cross-hatching.
Show[{ps,rps,pc,rpc}]




Filling with Dots

Points lined up vertically,
rpc=RegionPlot[0<=x<=2Pi&&Abs<=Abs[Cos]&&If[Cos>0,y>0,y<0], {x,0,2 Pi},{y,-1,1},
      Mesh->24, MeshStyle->{Directive[Gray,Dashing[{0.0,0.02}]],None},
      BoundaryStyle->None,PlotStyle->None, AspectRatio->Automatic]

Horizontal rows of points. (Maybe looks better.)
rpc=RegionPlot[0<=x<=2Pi&&Abs<=Abs[Cos]&&If[Cos>0,y>0,y<0], {x,0,2 Pi},{y,-1,1},
    Mesh->24, MeshStyle->{None,Directive[Gray,Dashing[{0.0,0.02}]]},
    BoundaryStyle->None,PlotStyle->None, AspectRatio->Automatic]

Combine with previous sine and cosine curves.
Show[{ps,rps,pc,rpc}]




POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract