This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Add-ons & Links / Standard Packages / Graphics /

Graphics`FilledPlot`

Generating filled plots.

This loads the package.

In[1]:= << Graphics`FilledPlot`

Here is a basic fill between the curve and the axis.

In[2]:= FilledPlot[Sin[x], {x, 0, 2 Pi}]

Out[2]=

This fills between the first and second curve and the second and third curve.

In[3]:= FilledPlot[{Sin[x], Cos[x], x^2/18},
{x, 0, 2 Pi}]

Out[3]=

Options for FilledPlot.

There are several ways to control the fills in your plots. A specification of Fills -> , , ... generates a plot with fills between curve n and n + 1 using . A specification of Fills -> , , , ... generates a plot with fills between and using . The curve specification Axis gives the axis. The option Curves controls how the lines of the curves are to be displayed. Specifying a value of Back causes curves to be covered by subsequent fills. A value of Front places all curves in front of the fills and a value of None causes the curves not to be drawn.

This specifies which curves to fill between and the gray levels of the filled regions.

In[4]:= FilledPlot[{x^2/18, Cos[x], Sin[x]},
{x, 0, 2 Pi},
Fills -> {{{1, Axis}, GrayLevel[.8]},
{{2, 3}, GrayLevel[.3]}},
Curves -> Front]

Out[4]=

You can use any standard graphics options in FilledPlot. The fill is plotted only where the defining curves exist (i.e., where the functions are real valued).

The function is real valued only for greater than , so this is the only region that is filled.

In[5]:= FilledPlot[{Cos[x], Sqrt[x^2 - 1]},
{x, -1.5, 1.5},
AspectRatio -> Automatic]

Out[5]=

Generating filled plots from data.

The package also allows you to create filled plots between curves specified by data, rather than equations. FilledListPlot accepts the same options for specifying fills as FilledPlot.

This is a filled plot from data.

In[6]:= FilledListPlot[{1,3,2,5,2}]

Out[6]=

This is a filled plot from data specified by and coordinates.

In[7]:= FilledListPlot[{{1.1, 2}, {2.5, 1},
{4.5, 3}, {5.2, 4.2}}]

Out[7]=

This is a filled plot of multiple data sets.

In[8]:= FilledListPlot[ {1,3,2,5,2},
{{1.1, 2}, {2.5, 1}, {4.5, 3}, {5.2, 4.2}}
]

Out[8]=

The AxesFront option.

The FilledPlot package defines a new option for Graphics objects called AxesFront. This is to allow the axes to be drawn over the graphic, so polygons will not obscure the tick marks. By default, the option is set to False; for the FilledPlot functions, it is set to True. Note that because this is a Graphics option, it can be used outside of FilledPlot. Also, when combining a FilledPlot with another graphics object, the usual option precedences will take effect (i.e., if the FilledPlot is drawn after a graphic with the option set to False, the polygons may overlay the axes).

This polygon covers the axes.

In[9]:= Show[Graphics[{GrayLevel[.6], Polygon[{{0,0},{1,0},{1,1}}]},
AxesFront -> False, Axes -> True,
AxesOrigin -> {.5,.5}]]

Out[9]=

Now the axes are over the polygon.

In[10]:= Show[Graphics[{GrayLevel[.6],
Polygon[{{0,0},{1,0},{1,1}}]},
AxesFront -> True, Axes -> True,
AxesOrigin -> {.5,.5}]]

Out[10]=