PlotE Documentation
II: Geometric Objects

Introduction

Mathematica  provides a variety of primitive geometric objects which the user can include in 2-dimensional graphics. PlotE makes those objects more convenient to use, in most cases providing many additional features. Several new types of objects have been introduced.

All of the geometric objects provided in PlotE can be used in two ways:
(1)   individual objects , such as Point[{1,2},Red]. In this construction, the 
       head gives the type of object, and the items inside describe it. Any 
       combination of objects may be included in a PlotE command.
(2)   options , as in Points->data. Here data might be a list of ordered pairs, 
       or a list of more complex descriptions of Point objects. Each option can be 
       used only once in a PlotE command, but any number of object descriptions 
       can be included in each option.

Individual objects and an option of the same type may be included in the same PlotE command. Any collection of objects could be included in either way. Generally individual objects are better to use when there are only a few objects, or when objects have complex descriptions. Options are better to use when there is a long list of simple objects, perhaps generated by a Table command.

It is not necessary to plot a function in order to make use of geometric objects in PlotE. The PlotE command can consist entirely of a sequence of geometric objects to be displayed.

The following types of geometric objects are supported in PlotE:
Points , Lines , Tangents, Vectors, Polygons , Rectangles , Regions,
Circles , Disks , Fields, and Grids. Those in italics are the graphics primitives provided by Mathematica . For these the standard syntax is supported; but that is just the beginning!

Points

Introduction to Points

Points may be included in a PlotE command in one of two ways: either through a Point object in the command, as in

PlotE[x^2,{-2,2},Point[{1,1},Red]];

or through a Points option, as in

PlotE[x^2,{-2,2},Points->{-1,0,1}];

Any number of points may be described in a single Points option. In the case of multiple points within a Points option, each point description is given by a sublist. You may also have any number of Point objects in addition to (or instead of) a Points option. There is no difference between using a Points option and using Point objects other than syntax.

Point Syntax

Position

A point description must give the ordered pair at which the point is to be placed. This can be done in three different ways:
 (i)    an ordered pair in braces such as {2,1}. In the simplest case this results in 
        the standard syntax for a Point primitive, Point[{2,1}].
 (ii)   an ordered pair without braces such as 2,1. This is provided for convenience 
        of the user who may for example prefer to type Point[2,1] instead of 
        Point[{2,1}].
 (iii)  a single real number such as 2. In this case the function being plotted is used 
        to calculate the other coordinate. Things get complicated if more than one 
        function is being plotted; see Points and Functions below.

The location should be given first in the point description, but this is not required.

Example

PlotE[x^2,{0,3},
	Point[2,1],
	Point[2],
	Point[{1,4}]
];

An equivalent form, and more convenient in this case, is

PlotE[x^2,{0,3},
	Points->{{2,1},2,{1,4}}
];

Style

One type of entry permitted in a point description is any graphics style directive appropriate for a point, i.e. those referring to color or dot size. Colors may be specified by using color primitives such as RGBColor, Hue, etc. or by color names such as Red, Green, etc. Dot size may be specified by the primitives PointSize and AbsolutePointSize or by the keywords Small, Medium, and Large. The actual sizes designated by Small, Medium, and Large can be controlled using options (described below). The default dot size for points is Medium.

Example

PlotE[x^2,{0,3},
	Point[Green,Large,2,1],
	Point[Medium,2],
	Point[Red,Small,{1,4}]
];

Text

Any text item in the Point description is taken to be a label for the point.

Example

PlotE[x^2,{0,3},
	Point[2,1,Green,"P",Large],
	Point[2,"Q"],
	Point[{1,4},Red,"R",Small]
];

The position of the text item can be controlled using the keywords Above, Below, Left, and Right. The default position is Above. You can use these directional indicators in any combination within a list, including multiple use of each direction (but opposites will cancel). The position can also by given directly by including Offset[a,b] (or Offset[{a,b}]) in the Point description. The amount of displacement generated by Above, Below, Left, and Right is controlled by the Offsets option discussed below.

Example

PlotE[x^2,{0,3},
	Point[2,1,Red,Large,"P",Offset[-0.05,0.03]],
	Point[2,"Q",Right],
	Point[{1,4},Green,Small,"R",Left,Above]
];

Points can also be labeled by their coordinates, in addition to any text label.  The keywords Coords, XCoord, and YCoord will respectively generate as text the ordered pair, x-coordinate, or y-coordinate for the point. The default location is below the point. The position of the coordinate(s) can be controlled as for text labels as above. The number of significant digits used in coordinate labels is controlled by the PointDigits option described below.
    Several text labels and/or coordinate labels may be attached to a single point. In this case, any position keywords or offsets must come after the label to which they apply and before the next label.

Example

PlotE[x^2,{0,3},
	Point[2,1,Red,Large,"P",Coords,Right],
	Point[2,"Q",Left,Above,XCoord],
	Point[{1,4},Green,Small,"R",Left,YCoord,Right,Below]
];

Extras

By including the keyword Open, you can produce an open dot. The keywords XLine and YLine will produce perpendicular lines to the x-axis or y-axis respectively. Style directives appropriate for lines may be included and will be applied to such lines. The keyword Flip will reverse the coordinates of any point.

Example

PlotE[x^2,{0,3},
	Point[1.5,"Q",Flip,Coords],
	Point[{1,4},Green,"R",Open,XLine,YLine,Dotted]
];

Points and Functions

As explained above, a number  in a point description is taken to be one coordinate of the point -- the other coordinate is calculated using the first eligible function to be plotted. In this case the point inherits the color of the function being plotted unless a different color is part of the point description.
     Only functions given by formulas  are eligible; equations, parametric equations, and data sets will not be used to calculate coordinates. If the formula uses the default vertical variable (set by the Variables option) as its independent variable, then the formula is used to find the first coordinate of the point rather than the second coordinate.
     If the point description contains the keyword All, a line is generated for each eligible function.

Example

In this example the equation is ignored in favor of the formula 4x — x2 for finding the second coordinate of the point.

PlotE[x + y == 3,4x - x^2,{0,4},Square,Point[1]];

In this example, the formula 4y — y2 is used to find the x-coordinate of the point rather than the y-coordinate, resulting in the point (3,1).

PlotE[4y - y^2,{0,4},Square,Point[1,Red,Coords]];

PlotE[4y - y^2,2x - x^2,{0,4},Square,Point[2]];

PlotE[4y - y^2,2x - x^2,{0,4},Square,
	Point[2,Coords,Left,Above,All]
];

If you wish to graph more than one function with each function used to evaluate  several points, it is suggested that you use a SubPlot construction.

PlotE[{0,4},{-1,1},
	SubPlot[Sin[Pi x],{0,4},Blue,Points->{1/2,3/2,5/2,7/2}],
	SubPlot[Cos[Pi x],{0,4},Red,Points->{0,1,2,3,4}]
];

Point Grouping

Elements of point descriptions can be applied to several points at once simply by grouping those elements in a list together with the desired point descriptions. This construction can be used either with the Points option or with Point objects. The lists of points and point descriptions can be nested to any depth. Here is an example, which also shows that it is not necessary to plot a function in order to use geometric objects.

PlotE[
	Points->{
		{	{{-1,-2},{-3,0},{-2,3},Green},
			{{4,2},{2,-3},{0,-1},Red},	Large},
		{{3,1,Open},{1,-4},Blue,Coords}
	}
];

data = Table[{Random[],Random[]},{10}];
PlotE[{0,1},Square,Points->{data,Green}];

This construction can also be used with Point objects.

PlotE[{-2,2},Square,
	{Table[Point[2 Cos[2Pi k/5],2 Sin[2Pi k/5]],{k,0,4}],Red},
	{Blue,Table[Point[Cos[2 Pi k/3],Sin[2 Pi k/3]],{k,0,2}]}
];

Point Options

SmallSize->0.01, MediumSize->0.02, LargeSize->0.03

These options control the PointSize directives generated by the keywords Small, Medium, and Large. For example, under these default values, the keyword Large as part of a point description would apply the style directive PointSize[0.03] to that point. These default values should be adjusted to best fit your display device and your tastes.

Offsets->{{-0.03,0.0},{0.03,0.0},{0.0,0.03},{0.0,-0.03}}

These options control the offset of text labels and coordinates generated by the keywords Left, Right, Above, and Below, respectively. These are scaled displacements which use the Scaled[{dx,dy},{x,y}] construction.

PointDigits->3

The number of significant digits used when coordinates of points are generated by the Coords, XCoords, or YCoords keywords. If a negative integer is given, that number of decimal places will be used.

Points->None

Gives a list of point descriptions to be included in the graphics displayed.

PointStyle->Automatic

A style primitive or list of style primitives refering only to color or pointsize that will be applied to all points unless overridden in an individual point description. The default of Automatic indicates that defaultstyle directives for points will be taken from the value of the DefaultStyles option. For example, the option PointStyle->Red would be equivalent to including the keyword Red in each point description.

Lines and Tangents

Introduction to Lines

Lines may be included in a PlotE command in one of two ways: either through a Line object in the command, as in

PlotE[x^2,{0,1},Same,Line[{0,0},{1,1},Red,Dotted]];

or through a Lines option, as in

PlotE[x^2,{0,2},Lines->{{0,1,Red},{1,2,Green}}];

Any number of lines may be described in a single Lines option. In the case of multiple lines within a Lines option, each line description is given by a sublist. You may also have any number of Line objects in addition to (or instead of) a Lines option. There is no difference between using a Lines option and using Line objects other than syntax.

Line Syntax

Position

A line description must give sufficient information to draw the line. This can be done in several ways:

Case I: Give two (or more) endpoints 
Each endpoint may be given as
(i)    an ordered pair in braces such as {2,1}.
(ii)   a single real number such as 2. In this case the function being plotted is used 
        to calculate the other coordinate. Things get complicated if more than one 
        function is being plotted; see Lines and Functions below.

The endpoints may be enclosed in list brackets, duplicating standard syntax for a line object as in Line[{{1,1},{2,3}}], or without list brackets, as in  Line[{1,1},{2,3}]. However if you give endpoints as single numbers, do not enclose them in a list, as this will be mistaken for a single endpoint. Any number of endpoints may be given, with ordered pairs and single numbers mixed together as in Line[{1,1},2,{3,5},4].

Case II: Give one point and the slope 
The point may be given as in Case I. The slope may be given by
(i)    including either of the keywords Horizontal or Vertical. In this case it 
       is not necessary to give a point; a single coordinate is enough.
(ii)   including Slope[m], where m is to be the slope of the line.
(iii)  including the keyword Tangent, in which case the slope is calculated from 
       the derivative of the function being plotted.

It is best, but not required, to give this information first in the line description. 
    Unlike points, lines do not inherit the color of a function used to evaluate coordinates.

Examples

PlotE[2x - x^2,{0,2},
	Line[{{1,0.2},{2,0.5}}],
	Line[{0.25,0.75},{1.11,0.33}],
	Line[0.5,Vertical],
	Line[1.2,Tangent]
];

Note the special color for the tangent line. See the TangentStyle option below.

PlotE[2x - x^2,{0,2},
	Line[0.5,1.75],
	Line[0.45,Horizontal],
	Line[{1.2,0.7},Slope[-1/2]]
];

PlotE[2x - x^2,{0,2},
	Line[0.25,{1.11,0.33},{0.71,0.71},1.88],
	Line[0.5,1.25,1.75]
];

Style

One type of entry permitted in a line description is any graphics style directive appropriate for a line, i.e. those referring to color, thickness or dashing. Colors may be specified by using color primitives such as RGBColor, Hue, etc. or by color names such as Red, Green, etc. Line thickness may be specified by the primitives Thickness and AbsoluteThickness or by the keywords Thick and Thin. The keyword Dotted or a Dashing primitive can be used to produce a dotted line. The actual thicknesses designated by Thick and by Thin and the actual Dashing primitive produced by Dotted are controlled by the options ThickSize, ThinSize, and Dashes (described below). The default style of a line is controlled by the option DefaultStyles.

Example

PlotE[2x - x^2,{0,2},
	Line[0.5,1.75,Red,Dotted],
	Line[0.45,Horizontal,Green,Thick],
	Line[{1.2,0.7},Slope[-1/2],Gray,Thin]
];

For many computers and displays, Thin may not affect the on-screen appearance of a line for ordinary graphics. If the graphic is expanded or printed on a high quality printer you may see a difference.

Dots

It is often useful to display the points used to plot a line. This can be done by including the keyword Dots in the line description. In Case I above two points are drawn; for Case II only the one point is drawn. Any entries in the line description applicable to a point description (such as Large, Coords, etc.) are applied to the drawing of these points. In particular the points are always the same color as the line.
    For complicated point descriptions, it may be best or necessary to give the endpoints as separate Point objects.

Examples

PlotE[2x - x^2,{0,2},
	Line[{0.25,0.75},{1.11,0.33},Dots,Green,Large],
	Line[0.5,Vertical,Dots,Cyan],
	Line[1.2,Tangent,Dots,Coords]
];

The option LineDots->True can be used to apply Dots to all lines drawn with a Lines option or as a Line object.

PlotE[2x - x^2,{0,2},
	Line[0.5,1.75,Red,Dotted],
	Line[0.45,Horizontal,Green,Thick],
	Line[{1.2,0.7},Slope[-1/2],Gray,Thin],
	LineDots->True
];

Text

Any text item in the Line description is taken to be a label for the line. The default location of the label is centered above the midpoint of the two endpoints used to describe the line (Case I) , or above the single given point (Case II). The location of the label can be changed using the keywords Above, Below, Left, Right, and Offset[a,b] as described in the section on Points.
    Text labels in a line description cannot be applied to points generated by the Dots keyword. However the keywords Coords, XCoords, and YCoords will be applied to any such points.

Example

PlotE[2x - x^2,{0,2},
	Line[0.5,1.75,Red,Dotted,"Line1",Dots,Coords,Above],
	Line[0.45,Horizontal,Green,Thick,"Line2",Below],
	Line[{1.2,0.7},Slope[-1/2],Gray,Thin,"Line3",Right]
];

Extras

Giving two points in a line description (Case I) results in a line segment. By including the keyword Extend, you can produce an "infinite" line, which extends to the edges of the plot. The Dots keyword can still be used and applies to the points given originally. This extension occurs automatically in Case II, where a point and slope are given. 
    The keyword Flip will reverse the coordinates of any points used to determine the line; in addition Horizontal and Vertical keywords will be exchanged for each other, and Slope[m] will be converted to Slope[1/m]. This affects Tangent as well; see the example below.
    An entry of the form Length[a] in a line description will adjust the line to be of total length a, extending equally in both directions from its midpoint.

If the apparent conflict with the standard use of Length bothers you, you may use Span[a] as an alternative. It bothers me too, but there is no other natural word available, and Length[a] with a a real number is so unusual for the standard use of Length that it would probably never occur.

Example

PlotE[x - (x^2)/2,{0,2},Square,Invert->Both,
	Line[0.5,1.75,Red,Length[1]],
	Line[0.5,1.75,Red,Extend,Flip],
	Line[1,Vertical,Flip,Cyan,Length[0.5]],
	Line[0.5,Tangent,Flip,Coords,Right],
	LineDots->True
];

A Special Case

The construction Lines->{{a,b},{c,d}} is taken to mean a single line. To give two separate lines with evaluated coordinates, use the construction Line[a,b],Line[c,d] instead.

Examples

PlotE[Sin[Pi x],{0,4},{-1,1},
	Lines->	{{0.5,1.0},{2.5,0.5}}
];

PlotE[Sin[Pi x],{0,4},{-1,1},
	Line[0.5,2.0],Line[2.5,0.5]
];

Lines and Functions

As explained above, a number  in a line description is taken to be one coordinate of a point -- the other coordinate is calculated using the first eligible function to be plotted. The exception to this behavior is when the line description also contains the keywords Horizontal or Vertical. For example, the meaning of Line[2,Horizontal] is a horizontal line of altitude 2. If you wish a horizontal line with altitude determined by the value of the plotted function at 2, you will have to indicate that directly, e.g. Line[f[2],Horizontal].
    Only functions given by formulas  are eligible; equations, parametric equations, and data sets will not be used to calculate coordinates. If the formula uses the default vertical variable (set by the Variables option) as its independent variable, then the formula is used to find the first coordinate of the point rather than the second coordinate.
    If the point description contains the keyword All, a line is generated for each eligible function.

Example

PlotE[2x - x^2,4x - 2x^2,{0,2},{0,4},Blue,
	Line[0.5,1.75,All,Magenta,Dots],
	Line[1,Horizontal,Green,Thick],
];

If you wish to graph more than one function with each function used to evaluate several lines, it is suggested that you use a SubPlot construction.

PlotE[{0,4},{-1,1},
	SubPlot[Sin[Pi x],{0,4},Blue,
		{Line[0.5,1.5],Line[2.5,3.5],Cyan}],
	SubPlot[Cos[Pi x],{0,4},Red,
		{Line[1,2],Line[2,3],Magenta}]
];

Lines and Grouping

The last example in the previous section provided an example of grouping , where a single keyword (in this case a color) was applied to more than one line by including it in a list with the desired lines. See the section on Point Grouping for more details concerning this technique. Here is another example showing how a Table command can create many lines with the same style applied to all.

PlotE[{0,1},Square,Frame,
	Lines->{
	{Table[{{0,0},{Cos[k Pi/2],Sin[k Pi/2]}},{k,0,1,0.1}],
	Red},
	{Table[{{1,1},{Cos[k Pi/2],Sin[k Pi/2]}},{k,0,1,0.1}],
	Cyan}}
];

Tangents

For the convenience of those wishing to draw one or more tangent lines to a curve, a Tangents option is provided. Each tangent can consist of a single number or a line description containing a single number plus keywords. The effect of the Tangents option is simply to append the Tangent keyword and treat each as a line. One can also use a Tangent object, which is equivalent to a Line object including the Tangent keyword. 
    Any line that results from a Tangents option, a Tangent object, or contains the Tangent keyword uses the TangentStyle option as its default style instead of LineStyle (see below). The LineLength option is convenient when plotting several tangents, as without it the tangent lines extend too far and clutter the picture.

Examples

PlotE[x^3,{-1,1},{-1,1},Same,
	Tangent[-0.5],Tangent[0.5],LineDots->True
];

PlotE[Sin[x],{0,2Pi},{-1,1},Gray,
	Tangents->{1.0,2.0,3.0,4.0,5.0,6.0},
	LineLength->0.75,LineDots->True
];

Tangents can also be applied to functions of the vertical variable.

PlotE[Sin[y],{y,0,2Pi},{x,-1,1},Gray,
	Tangents->{2.0,5.0},
	LineLength->0.75,LineDots->True
];

Line Options

Dashes->{0.02,0.01}

Controls the Dashing primitive produced by the keyword Dotted. With this default, the result is Dashing[{0.02,0.01}].

Lines->None

Gives a list of line descriptions to be included in the graphics displayed.

LineDots->False

The option LineDots->True is equivalent to including a Dots keyword in each line description.

LineLength->Automatic

Controls the length of all lines unless overridden in an individual line description. The default value Automatic has no effect, but LineLength->1 would be equivalent to including Length[1] in each line description.

LineStyle->Automatic

A style primitive or list of style primitives referring only to color, thickness, or dashing that will be applied to all lines unless overridden in an individual line description. The default of Automatic indicates that default style directives for lines will be taken from the value of the DefaultStyles option.

Tangents->None

A list of numbers or line descriptions containing a single number plus keywords. The effect of the Tangents option is simply to append the Tangent keyword and treat each as a line.

TangentStyle->Magenta

Similar to LineStyle, but applied to all tangent lines drawn via the Tangents option, a Tangent object, or a Tangent keyword in the line description.

ThickSize->0.01

Controls the Thickness primitive produced by the keyword Thick. With this default, the result is Thickness[0.01].

ThinSize->0

Controls the Thickness primitive produced by the keyword Thin. With this default, the result is Thickness[0].

Arrows and Vectors

Intoduction to Arrows

Arrow objects are very much like Line objects, but with added features for the drawing of arrowheads. You can use an Arrow object with a line description inside, and the arrowhead will be drawn automatically, or you can include keywords to control the drawing of the arrowhead.

Examples

PlotE[{-1,1},Square,
	Table[Arrow[{0,0},{Sin[x],Cos[x]},Hue[x/(2Pi)],
	Dashing[{0.04,0.02}]],
	{x,0,2Pi,Pi/3}]
];

PlotE[
	Arrow[{-2,3},{3,-2},Large,Wide,Barb]
];

Syntax

All the features of Lines are available with the exception of slope indicators: Horizontal, Vertical, Tangent, and Slope[m] are not accepted. The arrow description must provide two points, however either or both may be calculated from a function.

The additional keywords available to describe Arrows are:
Small, Medium, Large: describing the size of the arrowhead,
Narrow and Wide: describing the relative width of the arrowhead,
Barb and Line: describing the shape of the arrowhead, and
Double: asking for arrowheads on both ends of the line.

In addition, any of the standard options described in the Arrows package may be used as part of an Arrow description.

Examples

PlotE[Sin[x],{0,Pi},
	Arrows->Table[
		{{Pi/2,0.5},k Pi/4,Red,Dots,Coords,Above,Above},
	{k,0,4}]
];

PlotE[{-1,1},Square,
	Arrow[{0,0},0.2{Sin[0],Cos[0]},Red,Large,Narrow],
	Arrow[{0,0},0.35{Sin[Pi/3],Cos[Pi/3]},Blue,Large],
	Arrow[{0,0},0.50{Sin[2Pi/3],Cos[2Pi/3]},Green,Barb],
	Arrow[{0,0},0.65{Sin[Pi],Cos[Pi]},Cyan,Medium,Narrow],
	Arrow[{0,0},0.80{Sin[4Pi/3],Cos[4Pi/3]},
		Magenta,Small,Wide,Double,Line],
	Arrow[{0,0},0.95{Sin[5Pi/3],Cos[5Pi/3]},Gray,Wide,Barb],
];

As with other objects, an Arrows option is available, and grouping may be used as with points and lines.

Vectors

Vector is a synonym for Arrow, with one exception: only a single point may be given, in which case it is assumed to be the second point with (0,0) the first point. The syntax Vector[a,b,styles] is accepted as well as  Vector[{a,b},styles]. A separate Vectors option is available.

u = {-3,4}; v = {5,6};
PlotE[{-5,5},{0,10},
Vectors->{{u,Red,"u"},{v,Red,"v"},{u+v,Red,"u+v",Left}},
Arrows->{{u,u+v,Green,"v"},{v,u+v,Green,"u"}}];

Arrow Options

Arrows->None

Gives a list of arrow descriptions to be included in the graphics displayed.

ArrowLarge->0.07
ArrowMedium->0.05
ArrowSmall->0.03

The values of the HeadLength option referred to by the keywords Small, Medium, and Large in an arrow description.

ArrowStyle->Automatic

A style primitive or list of style primitives referring only to color, thickness, or dashing that will be applied to all arrows and vectors unless overridden in an individual description. The default of Automatic indicates that default style directives for arrows will be taken from the value of the DefaultStyles option.

ArrowNarrow->0.33
ArrowWide->0.75

The values of the HeadWidth option referred to by the keywords Narrow and Wide in an arrow description.

Vectors->None

Gives a list of vector descriptions to be included in the graphics displayed.

The following options are options for the Arrow primitive that are included in the package Graphics:Arrows and may be used in arrow descriptions. See the package documentation for descriptions of these options.

HeadScaling->Automatic

HeadLength->Automatic

HeadCenter->1

HeadWidth->0.5

HeadShape->Automatic

ZeroShape->Automatic

Polygons, Rectangles, and Regions

Introduction to Polygons

Polygons may be included in a PlotE command in one of two ways: either through a Polygon object in the command, as in

PlotE[{0,2},{0,1},
	Polygon[{1,0.3},{2,0.3},{1.5,0.7},
	Fill,Yellow,Edges,Blue,Dotted,Dots,Red,Medium]
];

or through a Polygons option, as in

PlotE[{0,2},{0,1},
	Polygons->{
	{{1,0.3},{2,0.3},{1.5,0.7},Green},
	{{0,0.2},{0.2,0.8},{0.3,0.5},Orange},
	{{0.7,0.7},{0.8,0.8},{0.9,0.7},Purple}
}];

As with all options, only one Polygons option may be in any PlotE command (additional ones would be ignored), but any number of polygons may be described in a single Polygons option. In the case of multiple polygons within a Polygons option, each polygon description is given by a sublist. You may also have any number of Polygon objects in addition to (or instead of) a Polygons option. There is no difference between using a Polygons option and using Polygon objects other than syntax.

Polygon Syntax

Position

A polygon description must contain the vertices of the polygon given as ordered pairs of points. These may be given in a list (standard syntax) or not in a list. It is best, but not required, to give this information first in the polygon description. A polygon is always considered to be closed, connecting the last vertex with the first.

Examples

PlotE[{0,1},{0,1},
	Polygon[{{0.2,0.5},{0.6,0.3},{0.9,0.7}}],
	Polygon[{0.1,0.1},{0.2,0.2},{0.1,0.3},{0,0.2}]
];

Style

There are three types of styles permitted in a polygon description:
 (i)   Fill: the Fill keyword indicates that the polygon is to be filled with a color 
       determined by one of the following, in order of priority:
       -- a color immediately following the Fill keyword
       -- the FillStyle option
       -- the DefaultStyles option
 (ii) Edges: the Edges keyword indicates that the polygon edges (lines between 
       consecutive vertices) are to be drawn, using styles determined by the 
       following, in order of priority:
       -- styles following Edges and before any Fill or Dots keyword
       -- the EdgeStyle option
      --  the DefaultStyles option
 (iii) Dots: the Dots keyword indicates that the polygon vertices are to be drawn, 
       using styles determined by the following, in order of priority:
       -- styles following Dots and before any Fill or Edges keyword
       -- the DotStyle option
       -- the DefaultStyles option

These three keywords can be used in any combination and in any order. If no style information is given, or if only a color is given, Fill is assumed, as seen in previous examples.
    For Edges and Dots, the information following the keyword can include not only style primitives, but anything recognized as part of a Line or Point object.
    For clarity, it is permitted (but not required) to group into lists the information for each of Fill, Edges and Dots.

PlotE[{0,1},{0,1},
	Polygon[{0.2,0.5},{0.6,0.3},{0.9,0.7},Edges,Dots,Coords],
];

PlotE[{0,1},{0,1},
	Polygon[{0.2,0.5},{0.6,0.3},{0.9,0.7},
		Cyan,Edges,Red,Thick],
	Polygon[{0.2,0},{0.4,0.2},{0.2,0.4},{0,0.2},
		{Dots,Gray,Medium,Open},{Fill,Magenta}]
];

Rectangles

Although rectangles can be easily described as polygons, a Rectangle object is provided in PlotE for consistency with the Mathematica  Rectangle primitive.

Rectangles may be thought of as a special polygon with a simplified description. The only syntactical difference between Rectangles and Polygons is that the location of a rectangle is given by the coordinates xmin, ymin, xmax, ymax. These coordinates (in that order) must be given in the rectangle description, either as real numbers or as ordered pairs.

PlotE[{0,1},Square,
	Rectangle[{0.2,0.5},{0.6,0.7},Green],
	Rectangle[0.6,0.1,0.9,0.3,Edges,Blue,Dotted]
];

A Rectangles option is also available and behaves just as other object options.

Regular Polygons

For regular polygons, you can use a RegularPolygon object with syntax
RegularPolygon[sides,center,radius,styles...]. This construction should be thought of as a special kind of polygon, and is internally converted to a Polygon object.

sides  is an integer giving the number of sides of the regular polygon.
center  is the center of the polygon.
radius  is the distance from the center of the polygon to each vertex.
styles  can be any style directives for a polygon object as described above.

All of the arguments are optional except for sides . Actually the syntax is more flexible; the only real requirement is that sides  must be given first.
    The default orientation of a regular polygon is one that results in a horizontal edge at the bottom of the polygon. If the keyword Trig is included in the description, the orientation will instead be one with a vertex on the positive x-axis.

For convenience, each of the following will also be accepted as the head of a regular polygon object: Triangle, Square, Pentagon, Hexagon, Heptagon, Octagon, Nonagon, Decagon. Their use is the same as RegularPolygon, except that the number of sides need not be given. However square brackets must be given even if no arguments are used, as in Triangle[]. Note that Triangle gives an equilateral triangle.

Examples

PlotE[{0,13},{0,8},Same,
	Triangle[{2,2},1.4],Square[{5,2},1.2],Pentagon[{8,2}],
	Hexagon[{11,2},0.8],Heptagon[{2,5}],Octagon[{5,5}],
	Nonagon[{8,5}],Decagon[{11,5}]
];

PlotE[{0,13},{0,8},Same,
	Table[
		RegularPolygon[k,{2 + 3*Mod[k-3,4],2 + 3*Quotient[k-3,4]}],
	{k,3,10}]
];

Regions

Elementary Regions

A Region is a special kind of polygon object, defined by the graphs of two functions. There are two types of regions, also called elementary regions, that may be described in a Region object.

(Type I)  We define the region by specifying the range of values for x, and by 
              giving a bottom function g(x) and a top function f(x). We can also 
              define the region by giving the inequalities

a † x † b
g(x) † y † f(x)

The syntax for a Type I region is Region[a,b,g[x],f[x],styles],
where styles  is any sequence of polygon styles as described above. However you will usually want to avoid the Dots keywords as it generates all the points usde to graph the two functions.

(Type II) We define the region by specifying the range of values for y, and by 
              giving a left function g(y) and a right function f(y). We can also 
              define the region by giving the inequalities

c † y † d
g(y) † x † f(y)

The syntax for a Type II region is Region[a,b,g[x],f[x],styles],
where styles  is any sequence of polygon styles as described above.

More complicated regions can be drawn by using more than one elementary region. Here are examples showing how the regions above were plotted.

Examples

PlotE[{x,0,5},{y,0,5},
	Region[1.5,3.5,Sin[x]+4,Cos[x]+2,Fill,Cyan,Edges,Red]
];

PlotE[{x,0,5},{y,0,5},
	Region[1.5,3.5,Sin[y]+3,Cos[y]+2,Fill,Cyan,Edges,Red]
];

Note that the only syntactical difference between descriptions of Type I and Type II regions is the use of the vertical variable (default: y) as the function variable in the third and fourth slots. If you wish to use variables other than x and y, there are a variety of ways to distinguish the horizontal and vertical variables --  see the section on Variables. Unless there is some indication otherwise, the variable used in a Region object will be taken to be the horizontal variable.

There is also a Regions option that allows you to give a list of region descriptions, in the same way as the Polygons option.

Regions and Parametric Equations

Regions can also be used in conjunction with parametric equations. Two sets of parametric equations are involved; the region is the area between the two graphs. The syntax is Region[a,b,{g1[t],g2[t]},{f1[t],f2[t]},styles].

In the case of polar coordinate equations graphed as parametric equations, you can think of the two functions as inside and outside functions. If there is no inside function, it can be omitted, or given as {0,0} in the third position.

Examples

PlotE[{x,-1,1},Square,Frame,
	Region[0,2Pi,{0.5 Cos[t],0.8 Sin[t]},{Cos[t],Sin[t]},
	Cyan,Edges,Gray]
];

Here is an example of the graph of the polar coordinate equation r = cos(3θ).

PlotE[{x,-1,1},Square,
	Region[0,Pi,{Cos[3t] Cos[t],Cos[3t] Sin[t]},
	Cyan,Edges,Gray]
];

Polygons and Grouping

The concept of grouping was introduced in the section on Points, subsection Point Grouping. Here are two examples showing how styles can be applied to more than one polygon by using a list with the polygon descriptions followed by the styles to be applied to them.

Examples

PlotE[{-1,1},Square,Frame,
	{Decagon[Yellow],Pentagon[1/2,Cyan],Dots,Red,Edges,Gray}
	
];

PlotE[{0,13},{0,8},Same,
	{Triangle[{2,2},1.4],Hexagon[{11,2},0.8],Red},
	{Square[{5,2},1.2],Decagon[{11,5}],Magenta},
	{Pentagon[{8,2}],Octagon[{5,5}],Green},
	{Heptagon[{2,5}],Nonagon[{8,5}],Cyan}
];

Polygon Options

DotStyle->Automatic

This option is applied to all points generated by the Dots keyword in all polygons or related objects (regular polygons, regions), unless overridden in an individual polygon description. The value Automatic means the style will be taken from the value of the option DefaultStyles.

EdgeStyle->Automatic

This option is applied to all lines generated by the Edges keyword in all polygons or related objects (rectangles, regular polygons, regions), unless overridden in an individual polygon description. The value Automatic means the style will be taken from the value of the option DefaultStyles.

FillStyle->Automatic

This option is applied to polygon fills generated by all polygons or related objects (rectangles, regular polygons, regions), unless overridden in an individual polygon description. The value Automatic means the style will be taken from the value of the option DefaultStyles.

Polygons->None

Gives a list of polygon descriptions to be included in the graphics displayed.

Rectangles->None

Gives a list of rectangle descriptions to be included in the graphics displayed.

Regions->None

Gives a list of region descriptions to be included in the graphics displayed.

Circles and Disks

Introduction to Circles and Disks

Circles and Disks are very similar types of objects. In PlotE you can use these objects interchangeably. The only difference is that a Disk is by default filled, and a Circle is by default not filled.

PlotE[{0,4},{0,4},Same,
	Disk[{1,1},0.8,Red],
	Circle[{3,3},0.8,Blue]
];

Circle and Disk Syntax

Position

Each Circle or Disk description can have a center , a radius , an arc , and styles. All of this is optional: the default values are a center at (0,0), a radius of 1, and an arc of [0,2„]. The center and arc are given as ordered pairs, and the radius may be given as a number or an ordered pair. An ordered pair for a radius indicates an ellipse.
    A number in the description will be recognized as the radius regardless of position. The first ordered pair will be taken to be the center. The second ordered pair is taken to be the radii unless a number is also present. If the center and radius are accounted for, another ordered pair is taken to be the arc. Notice that an arc cannot be given unless the center and radius are also given.

Example

PlotE[{-2,2},Square,
	Disk[0.5,Red],
	Circle[{1,1},Green]
];

An arc is described by giving standard angle measurements in radians.

PlotE[{0,4},{0,4},Same,
	Circle[{2,2},1.5,{Pi,5Pi/2},Red]
];

Styles

Styles are given in the same way as for polygons and regions. A Disk is taken to be filled unless Edges or Dots is used without Fill or a leading color. A Circle is filled only if Fill or a leading color is used.
    Edges refers to the boundary circle, which is automatically drawn for a Circle if no other keyword is used or if a leading color is given. Dots refers only to the center point.

Examples

PlotE[{0,4},{0,4},Same,
	Disk[{1,1},0.8,Red,Edges],
	Disk[{3,3},0.8,Edges,Green,Dotted,Dots,Red]
];

PlotE[{0,4},{0,4},Same,
	Circle[{1,1},{0.5,1},{0,4Pi/3},Fill,Cyan],
	Circle[{3,3},0.8,Green,Thick]
];

Same

If the keyword Same is not used in the PlotE command, disks and circle will very likely be distorted. This can be avoided by including Same in individual disk or circle descriptions. This will guarantee a visually circular shape.The radius is altered in the process by dividing the vertical radius by the aspectratio of the plot.

PlotE[{0,4},{0,4},
	Disk[{1,1},0.8,Red],
	Circle[{3,3},0.8,Blue,Same]
];

Grouping

As with other objects, information can be added to each of a list of Disk or Circle descriptions by grouping the information together with the descriptions in a list. Here the list is created by a Table command.

PlotE[{-2,2},Square,
	{Table[Disk[{Cos[2 Pi k/8],Sin[2 Pi k/8]},0.1 + 0.025 k],
	{k,0,7}],	Green,Edges}
];

Circle and Disk Options

Circles->None

Gives a list of circle descriptions to be included in the graphics displayed.

Disks->None

Gives a list of disk descriptions to be included in the graphics displayed.

Fields

Introduction to Fields

There are two kinds of fields available in PlotE. A "slope field" is a rectangular array of lines, and a "vector field" is a rectangular array of arrows. In both cases the field is a geometric representation of a function which assigns a slope or arrow to each point. As with other geometric objects, you can use a Field[...] construction with a field description inside, or a Fields->{...} construction with one or more field descriptions inside. Actually you will seldom want to use more than one field at a time.

Slope Field

A slope field is used to geometrically represent certain first-order differential differential equations. Here is such a representation of y'(x) = y, together with several solutions.

PlotE[{Exp[t],-2Exp[t],0.4Exp[t]},{t,-3,3},{y,-3,3},
Field[y,{20,12}], Points->{0,All}];

Vector Field

Vector fields are used to represent physical quantities such as velocity that have both magnitude and direction. The following example might represent the velocity of a fluid in circulatory motion.

PlotE[{x,-2,2},Square,
Fields->{{y,-x},10,0.75,Green}];

Field Syntax

Function

The first entry in a field description must either be a function of the horizontal and vertical variables (for a slope field), or a list of two such functions (for a vector field). All other entries are optional.

Positions

You can specify the number of the field lines (or arrows) you want in the horizontal and vertical directions. This can be done in several different ways.

a single integer n: will result in an n x n array of lines.

a pair of integers {m,n}: will result in an m x n array of lines, m in the horizontal direction and n in the vertical direction.

a pair of iterators: indicating the range and optionally the spacing of the lines in the horizontal and vertical directions. Each iterator may be one of the forms:
    {var,min,max}, {var,min,max,step}

Note that by using such iterators, you can define fields that do not cover the entire plotted region.

If none of the above are given, or if the optional step is omitted from the iterators, the value of the option FieldLines is used to determine the number of field lines in each direction. This option is initially set to {10,6} which works well with the default value of AspectRatio. If you are working on a fast machine or want more detail, you may want to use {20,12} instead. If you use Square you may want to use {10,10} (or simply 10) .

The positions of the lines or arrows are then determined from the information given; the positions are offset so that the lines or arrows remain within the plotted region.  For a slope field, a line segment is plotted with midpoint at each designated position and with slope given by the function. For a vector field, an arrow is plotted with tail at each designated position and with x- and y-components given by the pair of functions.

Example

Here is an example of a field that does not cover the entire plotted region.

PlotE[{-2Pi,2Pi},{-2,2},
	Field[Cos[x/2],{x,-4,4,1},{y,0,2,0.5},Green]
];

Length

A real number in the field description will describe the length of the lines or arrows. In the case of slope field, the length represents the proportion of the distance between adjacent positions that each field line should use.
    For vectors fields the situation is more complicated, since vectors can have different lengths. If the lengths of the vectors are greater than the intervals between them, the result can be confusing, especially if the vectors extend out of the viewing rectangle. Therefore for vector fields the length parameter represents the length of the longest vector, again as a proportion of the distance between adjacent positions. Other vectors are scaled proportionately. You can insist on showing the actual lengths of the vectors by using the keyword True. 
    The default value of the length parameter is determined by the option FieldLength, initially set to 0.5.

PlotE[{x,-2,2},Square,
Field[{y,-x},10,0.75,Green,True]];

Style

Any style primitives appropriate for lines may be included in an field description, and these will make up the style for the lines in the field. If none are given, the value of the option FieldStyle is used. It is initially set to Gray.
    In the case of vector fields, you can also include any options appropriate for arrows.

Field Options

FieldLines->{10,6}

The dimensions of the array of field lines.

FieldLength->0.5

The default value of the length parameter applied to fields. For slope fields, this is the length of all field lines as a proportion of the distance between adjacent positions. For vector fields, this is the length of the longest vector as a proportion of the distance between adjacent positions.

FieldStyle->Gray

The default style primitives applied to all fields unless overridden in an individual field description.

Fields->None

Gives a list of field descriptions to be included in the graphics displayed.

Grids

Introduction to Grids

A Grid object gives a rectangular latticework of lines. Grids can be specfied by the number of grid lines, by the distance between grid lines, or by the coordinates of the grid lines.

PlotE[4x^2 + 9y^2 == 36,{-3,3},Square,Frame,
	Grid[{0.5,0.5}]
];

Grid Syntax

Position

The default positions of the grid lines, indicated by the use of the keyword Automatic, is at the major tick marks.  The positions of the grid lines can be specified in several ways.
(i)   The use of the keyword Automatic places a certain number of evenly  
       spaced grid lines in reasonable positions. The number of grid lines is each 
       direction is controlled by the option GridSteps. 
(ii)  The use of the keyword Ticks will place gridlines at each labeled tick mark.
(iii) An positive integer can be given to specify the number of grid lines.
(iv) A positive real number (excluding exact integers) may be given to specify the 
      distance between grid lines.
(v)  A list of actual coordinates for the location of grid	lines may be given.
    
   If any of these five options is used, the result is applied to both the horizontal and vertical directions. Alternatively, any two such specifications may be given, the first applied in the horizontal direction (to determine the vertical grid lines), and the second applied in the vertical direction, (to determine the horizontal grid lines). The two specifications may be given separately or in a list. The different types of grid specifications may be mixed in any way, for example

{8,Ticks}, {Automatic,0.6}, {{0.2,0.5,1.0,2.0},0.5}

If the positions of the grid lines are not specified in any way, then Automatic is used, which invokes the value of the GridSteps option.

Style

Any styles appropriate for lines may be included in the grid description. If none are given the value of the GridStyle option will be used.

Examples

PlotE[{-3,3},Square,Frame,
	Grid[0.5,Green]
];

PlotE[{-3,3},Square,
	Grid[8,Ticks,Magenta]
];

PlotE[{-3,3},Square,
	Grid[{{-1,0.4,2.5},{-2.3,-0.4,0,1.2,2.4}},Blue,Dotted]
];

Features

As with other objects, a Grids option is available as a means of giving a list of grid descriptions. Grid objects are the only objects that do not respond to grouping. (See the sections on Points and Lines for a discussion of grouping.)

The keyword Grid, if used in a PlotE command, is equivalent to Grid[Automatic], and creates a grid with the default number of horizontal and vertical lines.

If Frame is not used, grid lines will ordinarily not be drawn over an axis, as seen in the last two examples. The keyword Axes in a grid description requests that grid lines be drawn over the axes.

PlotE[{-3,3},Square,
	Grid[{8,Ticks},Magenta,Axes]
];

Rectangle

It is possible to control the rectangle in which a grid is drawn, by giving an item of the form {{xmin, ymin}, {xmax, ymax}} in the grid description.

PlotE[{-3,3},Square,Frame,
	Grid[0.5,Green,{{-1,-2},{2,1}}]
];

Grid Fills

A grid divides the plot region into rectangles.  These rectangles can be filled according to whether each is "inside", "outside", or on the boundary of a region given by an equation. "Inside" consists of rectangles all of whose corner points satisfy the inequality resulting from replacing the equals signs by "less than", and "outside" similarly corresponds to "greater than". A rectangle lies on the boundary some of its corner points are inside and some are outside.

To request that the grid rectangles be filled in this way, include the keyword Fill followed by the equation in brackets. An expression expr in one variable is taken to represent y == expr, and an expression in two variables is taken to represent expr == 0. The colors used for the fill are controlled by the option GridFillColors.

Examples

PlotE[4x^2 + 9y^2 == 36,{-3,3},Square,Frame,
	Grid[{0.5,0.5},Fill[4x^2 + 9y^2 == 36]]
];

PlotE[{-3,3},Square,Frame,
	Grid[{0.5,0.5},Fill[2 - x^2]]
];

PlotE[{-3,3},Square,Frame,
	Grid[{0.5,0.5},Fill[4x^2 - 9y^2]],
	GridFillColors->{Cyan,Blue,Yellow}
];

Grid Options

GridFillColors->{Yellow,Red,None}

The colors used for inside, boundary, and outside respectively in grid fills.

Grids->None

Gives a list of grid descriptions to be included in the graphics displayed.

GridSteps->{10,6}

The default number of grid lines in each direction, used when the keyword Automatic is used for either or both directions.

GridStyle->{Gray}

A default style to be applied to grid lines.

Symmetry Operations

Introduction

Four commands are provided for manipulating geometric objects: Translate, Rotate, Dilate, and Reflect. Each of these can act on any geometric object, or on an entire Graphics object, e.g. the output of a PlotE command. Within a geometric object, each of these commands operates upon ordered pairs of numbers representing points. Within a Graphics object, or other structure containing geometric objects, these commands operate only on the contained geometric objects, in particular on each graphics primitive.
    While simple and powerful, this prescription has limitations. Rotation and reflection of Circle and Disk objects affect only the position but not the orientation of the object due to limitations of the built-in primitives. Field and Grid objects can be transformed after being plotted, but not before.

Rotate

The Rotate command will rotate counterclockwise about the origin by the specified number of radians. The syntax is Rotate[radians,item]. Using  Square for the plot coordinates guarantees a good visualization of the rotation.

Examples

Rotate[Pi/2,Point[{-2,3}]]

graph1 = 
	PlotE[x^3,{-1,1},Square,Hide];
Show[graph1,Rotate[Pi/3,graph1]];

myDisk = Disk[{1,1},{0.5,0.3},Red];
PlotE[{-3,3},Square,
	myDisk,Rotate[Pi/3,myDisk],
	Rotate[Pi/4,Square[3,Edges,Green,Dots,Blue]]
];

To rotate about a point (a,b) other than the origin, use the syntax Rotate[radians,{a,b},item]. The next example illustrates rotating an ellipse. While this cannot be done with a Circle object, it can be done using parametric equations to draw the ellipse.

myEllipse = 
	PlotE[{Cos[t],0.5 Sin[t]},{t,0,2Pi},
	{x,-3,3},Square,Para,Hide];
Show[
	myEllipse,
	Rotate[Pi/4,{1,1},myEllipse]
];

Translate

This command shifts an object by specified displacements in the horizontal and vertical directions. The syntax is Translate[{h,k},object]. The point [a,b] is changed to [a+h,b+k]. This command is seldom necessary in itself as there is almost always a simple way to give the desired position of an object. However it can be useful in combination with other symmetry operations.

Translate[{-2,3},Rectangle[{1,2},{3,4}]]

graph2 = 
	PlotE[{Sin[3t] Cos[t],Sin[3t] Sin[t]},{t,0,2Pi},Para,
	{x,-1,1},Square,Hide];

Show[Translate[{0.1,-0.3},Rotate[Pi/3,graph2]]];

Dilate

This command stretchs or shrinks an object by specified factors in the horizontal and vertical directions. The syntax is Dilate[object,{h,k}]. The point [a,b] is changed to [h*a,k*b]. This command does not work on Circle or Disk object; use different radii instead.

Show[Dilate[{0.5,1.0},graph2]];

Reflect

The Reflect command will reflect an object about a line. To reflect across the x- or y-axis use Reflect[x,item] or Reflect[y,item]. To reflect across a line through the origin at angle theta, use Reflect[theta,item]. (If you know the slope of the line rather than the angle, use ArcTan[slope] as the angle.) To reflect across a line through the point (a,b) at angle theta, use Reflect[theta,{a,b},item].

Example

myHex = Hexagon[0.5,{1,1},Magenta];
PlotE[{-3,3},Square,
	myHex,
	Reflect[x,myHex],
	Reflect[3Pi/4,myHex],
		Line[{0,0},Slope[-1],Green,Dotted],
	Reflect[-Pi/3,{0,1},myHex],
		Line[{0,1},Slope[-Sqrt[3]],Green,Dotted],
];