plot
::Hatch
Hatched area
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
plot::Hatch(f_{1}
,f_{2}
, <x_{1} .. x_{2}
>, <a = a_{min} .. a_{max}
>,options
) plot::Hatch(f_{1}
, <base
>, <x_{1} .. x_{2}
>, <a = a_{min} .. a_{max}
>,options
) plot::Hatch(c
, <a = a_{min} .. a_{max}
>,options
)
plot::Hatch(f)
hatches the area between the
function f
and the xaxis.
plot::Hatch(f, base)
hatches the area between
the function f
and the horizontal line y = base.
plot::Hatch(f, g)
hatches the area between
the two functions f
and g
.
plot::Hatch(c)
hatches the area enclosed
by the curve c
.
plot::Hatch(f, base)
is the hatched area
between a function f
of type plot::Function2d
and a line parallel
to the xaxis with y = base.
If base
is omitted, the area between the function
and the xaxis will be hatched (the baseline is assumed to be the
xaxis). See Example 1.
plot::Hatch( f_{1}, f_{2})
is
the hatched area between two functions f_{1}
and f_{2}
.
See Example 2.
plot::Hatch(c)
is the hatched area enclosed
by a plot::Curve2d
.
A curve is closed automatically by connecting the starting point and
the end point. See Example 3.
The hatch may be restricted to the left and to the right by
a range x_..x_
. See Example 4.
The attributes FillColor and FillPattern can be used to change the color and pattern of the hatched area. See Example 5.
A plot::Hatch
is only the hatched area without outlining
functions or curves! To see the border lines, you need to plot them
separately as demonstrated in the examples.
Attribute  Purpose  Default Value 

AffectViewingBox  influence of objects on the ViewingBox of
a scene  TRUE 
AntiAliased  antialiased lines and points?  TRUE 
Baseline  constant second function delimiting hatch  
Color  the main color  RGB::Red 
FillColor  color of areas and surfaces  RGB::Red 
FillPattern  type of area filling  DiagonalLines 
Frames  the number of frames in an animation  50 
Function1  first function/curve delimiting hatch  
Function2  second function delimiting hatch  
Legend  makes a legend entry  
LegendText  short explanatory text for legend  
LegendEntry  add this object to the legend?  FALSE 
Name  the name of a plot object (for browser and legend)  
ParameterEnd  end value of the animation parameter  
ParameterName  name of the animation parameter  
ParameterBegin  initial value of the animation parameter  
ParameterRange  range of the animation parameter  
TimeEnd  end time of the animation  10.0 
TimeBegin  start time of the animation  0.0 
TimeRange  the real time span of an animation  0.0 .. 10.0 
Title  object title  
TitleFont  font of object titles  [" sansserif " , 11 ] 
TitlePosition  position of object titles  
TitleAlignment  horizontal alignment of titles w.r.t. their coordinates  Center 
TitlePositionX  position of object titles, x component  
TitlePositionY  position of object titles, y component  
Visible  visibility  TRUE 
VisibleAfter  object visible after this time value  
VisibleBefore  object visible until this time value  
VisibleFromTo  object visible during this time range  
VisibleAfterEnd  object visible after its animation time ended?  TRUE 
VisibleBeforeBegin  object visible before its animation time starts?  TRUE 
XMax  final value of parameter “x”  infinity 
XMin  initial value of parameter “x”  infinity 
XRange  range of parameter “x”  infinity .. infinity 
If given a single plot::Function2d
object, plot::Hatch
hatches
the area between the curve and the xaxis:
f := plot::Function2d(sin(x), x = PI..PI): plot(plot::Hatch(f), f)
Note that plot::Hatch
requires an object of
type plot::Function2d
,
not just a function expression:
plot::Hatch(sin(x))
Error: Missing argument of type 'plot::Function2d' or 'plot::Curve2d'. [plot::Hatch::new]
plot::Hatch
can be asked to hatch the area
between a function graph and some constant value (i.e., some line
parallel to the xaxis):
plot(plot::Hatch(f, 1), f)
For functions with poles, keeping VerticalAsymptotesVisible
set
to TRUE
is highly recommended:
f := plot::Function2d(1/(x  1)): h := plot::Hatch(f): plot(f, h)
delete f, h:
By passing two functions to plot::Hatch
,
we ask for a hatch of the area between the two:
f := plot::Function2d(sin(x), x = 4 .. 4, Color = RGB::Blue): g := plot::Function2d(cos(2*x), x = 4 .. 4, Color=RGB::Black): h := plot::Hatch(f, g): plot(f, g, h)
delete f, g, h:
plot::Hatch
can also hatch the inner part
of a plot::Curve2d
object:
circle := plot::Curve2d([sin(t), cos(t)], t=0..2*PI): plot(circle, plot::Hatch(circle))
If the curve is not closed, plot::Hatch
regards
the first and last point to be connected:
circle::UMax := 3*PI/2: plot(circle, plot::Hatch(circle))
delete circle:
By default, plot::Hatch
extends as far to
the left and right as possible without leaving the common definition
area of all given functions:
f := plot::Function2d(sin(x), x = 0 .. 5): g := plot::Function2d(cos(x), x = 1 .. 4): h := plot::Hatch(f, g): plot(f, g, h)
You can restrict this range by giving an explicit range of x values:
h := plot::Hatch(f, g, 1 .. 3): plot(f, g, h)
However, it is not possible to extend the range beyond the common definition range of both functions:
h := plot::Hatch(f, g, 1 .. 3): plot(f, g, h)
The restriction of the x range also works for hatching curve objects:
c := plot::Curve2d([sin(5*x), cos(7*x)], x = 0 .. 2*PI): h := plot::Hatch(c, 0 .. 1): plot(c, h)
Note that plot::Hatch
reacts to the smoothness
of the curve. This is one of the reasons why you have to provide a objects instead
of expressions for the functions or curves:
c::AdaptiveMesh := 2: plot(c, h)
delete f, g, h, c:
One of the most useful attributes of plot::Hatch
is FillPattern
,
which can take one of the values DiagonalLines
(the
default), FDiagonalLines
, HorizontalLines
, VerticalLines
, CrossedLines
, XCrossedLines
,
or Solid
:
f := plot::Function2d(sin(x)): h := plot::Hatch(f, FillPattern = VerticalLines): plot(f, h)
Another attribute that will often be useful is FillColor
,
to change the color of the hatch. We set the value right in our existing
hatch object:
h::FillPattern := CrossedLines: h::FillColor := RGB::Blue: plot(f, h)
delete f, h:
The function(s) or curve, the baseline, and the restriction of the x range can be animated:
f := plot::Function2d(sin(x + a), x = PI..PI, a = 0..2*PI): g := plot::Function2d(cos(x  a), x = PI..PI, a = 0..4*PI): plot(f, g, plot::Hatch(f, g, x0 .. x0+1, x0 = PI..3))
f := plot::Function2d(sin(a*x), x=PI..PI, a=0.2..3): plot(f, plot::Hatch(f))
delete f, g:
A “hatch” may also be a solid area fill:
plot(plot::Hatch( plot::Curve2d([abs(r)*sin(r), abs(r)*cos(r)], r = PI..PI), FillPattern = Solid, FillColor = RGB::Red, Axes = None))

The outlining function(s) of the hatch: objects of type


The outlining curve of the hatch: a parametrized curve of type


The base line of the hatch: a numerical real value or an arithmetical expression of
the animation parameter


A range on the xaxis limiting the hatch to the left and the
right hand side:numerical real values or arithmetical expressions of
the animation paramater


Animation parameter, specified as 