Plot a straight line - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Getting Started : How Do I... : Plot a straight line

How Do I

 Plot a Straight Line?

This help page is intended as a guide to the commands available in Maple for plotting straight lines. You can plot a line with the commands plottools[line] and plot. With the commands Student[MultivariateCalculus][Line] and geometry[line], you can define a line and then work with it.

The plottools[line] Command

Use the plottools:-line command to plot a line segment.  The plottools:-line command creates a plot data object, which can then be displayed, possibly in combination with other plot objects, with the plot:-display command.

For more information, see plottools[line].

Example

 > $\mathrm{with}\left(\mathrm{plottools}\right):$
 > $\mathrm{with}\left(\mathrm{plots}\right):$
 > $\mathrm{display}\left(\mathrm{line}\left(\left[0,0\right],\left[3,4\right],\mathrm{color}="Blue"\right)\right)$

The Plot Command

Use the plot command to plot an expression that represents a line over an interval.

For more information on the plot command, see plot. For more information on plot command options, see plot,options.

Example: Using the Plot Command

 >

Example: Using the Context Panel

Follow the steps below to plot the function $y={x}^{}+7$.

Step

Description

Illustration

1

Type $y={x}^{}+7$.

2

Click the equation, and from the context panel, select Plots > 2-D Plot of Right Side.



The plot is displayed in the worksheet or document

$y=x+7$$\to$

Example: Using the Interactive Plot Builder

Follow the steps below to plot the function $y={x}^{}+7$.

 Step Description Illustration 1 Type the expression $y=x+7$. Do not type an equation, since the Plot Builder interprets equations as implicit plots. $x+7$ 2 Click the expression, and from the context panel, select Plot Builder.   Note that if the Plot Builder is accessed from the main menu (Tools > Assistants > Plot Builder...), then the expression  must be entered manually. 3 A plot is displayed, and the Plot Builder panel is displayed on the right side of the Maple window. The plot type and plot ranges for independent variables can be set here, along with plotting options.     For this example, we use the default settings. Click the worksheet to hide the panel.

Example: Plotting a Horizontal Line

 > $\mathrm{plot}\left(5\right)$

Example: Plotting a Vertical Line

Example 1: Using the plot command to plot x=5

This line cannot be obtained as the graph of a function, so Maple's plot command will not graph the vertical line without user intervention. Here, a portion of the line is drawn as a line segment, with the line segment represented by the parametric curve

For more information on plotting vertical lines, see MaplePortal,PlottingTips.

 >

Student[MultivariateCalculus][Line]

The Student[MultivariateCalculus][Line] command is available to all Maple users, although primarily intended for use by students and instructors of courses on multivariate calculus, as these courses typically start with lectures on vectors, lines, and planes.

Use the Student[MultivariateCalculus][Line] command to create a line object.  The Student[MultivariateCalculus] package contains many commands for interacting with line objects.

For more information about the Line command, see Student[MultivariateCalculus][Line]. For more information about the Student[MultivariateCalculus] subpackage, see Student[MultivariateCalculus].

Examples

Lines in two-dimensional space.  Here we define the lines using equations and find their intersection.

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{MultivariateCalculus}\right]\right):$
 >
 > $\mathrm{l2}≔\mathrm{Line}\left(4\cdot x-5\cdot y=20\right):$
 > $\mathrm{GetIntersection}\left(\mathrm{l1},\mathrm{l2}\right)$
 $\left[{-55}{,}{-48}\right]$ (3.1.1)

Lines in three-dimensional space.  We construct two lines; the first contains the point $\left[1,0,2\right]$ and the direction $⟨2,-2,1⟩$, the second the points $\left[5,-3,1\right]$ and $\left[3,-3,6\right]$.  We check whether the lines are parallel.

 > $\mathrm{l3}≔\mathrm{Line}\left(\left[1,0,2\right],⟨2,-2,1⟩\right):$
 > $\mathrm{l4}≔\mathrm{Line}\left(\left[5,-3,1\right],\left[3,-3,6\right]\right):$
 > $\mathrm{AreParallel}\left(\mathrm{l3},\mathrm{l4}\right)$
 ${\mathrm{false}}$ (3.1.2)

The geometry[line] and segment Commands

The geometry[line] and geometry[segment] commands enable you to work in 2-D Euclidean geometry. With this package you can create line and line segment objects. You can interact with these objects using other commands offered in the geometry package.  The table below provides a quick summary of commands available for use with each type of object:

 Object Available commands line segment line

For more information, see geometry[line] and geometry[segement].

Example

 > $\mathrm{with}\left(\mathrm{geometry}\right):$
 >
 >
 > $\mathrm{detail}\left(Q\right)$
 ${\mathrm{GeometryDetail}}{}\left(\left[{"name of the object"}{,}{Q}\right]{,}\left[{"form of the object"}{,}{\mathrm{point2d}}\right]{,}\left[{"coordinates of the point"}{,}\left[{6}{,}{-}{5}\right]\right]\right)$ (4.1.1)
 Related Topics The How Do I... topics cover the essentials for doing mathematics in Maple. Learn more about available tools and features, such as palettes and the context panel. Refer to Help>Quick Reference for basic Getting Started tips.

 See Also