MaplePortal/PlottingTips - 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 : MaplePortal/PlottingTips

Plotting Tips: Vertical Lines and Axis Labels

Go to Maple Portal    




Plotting the Graph of a Vertical Line

Controlling the Labeling of an Axis

Graphing Efficiently: Return a Command You Can Reuse

See Also


Certain graphing techniques are essential in the classroom but are not covered by basic plotting examples in Maple.  Here, you will learn three interactive plotting strategies:


plot vertical lines


control axis labels (for instance, labels with multiples of π)


create a graph interactively and then efficiently reuse that graph


These are not complicated techniques, and once you have discovered them you will be able to employ them to make better graphs for classroom presentations and handouts as well as save yourself time and effort.


Commands, context-sensitive operations, and the Plot Builder are discussed.  The Plot Builder is Maple's most robust interactive plotting tool.  It provides access to a variety of plot types and to the plot options that enable you to customize your graph.  As you change the options in the Plot Builder, preview your graph.  When you are satisfied, return a plotting command that can be reused and modified.  With the Plot Builder, your plots can be easier to read and convey more useful information.




Plotting the Graph of a Vertical Line

In the xy-plane, the graph of the solution set of the equation x=1 is a vertical line.  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.  Figure 1 shows a portion of this line drawn with the plot command as a line segment.  Figure 2 draws this same line segment as the parametric curve xt=1,yt=t.




Figure 1   Graph of the vertical line segment by specifying its endpoints

Figure 2   Parametric plot of the vertical line segment

Clearly, graphing a vertical line segment via the plot command requires significant user intervention and knowledge of Maple syntax.  Figure 3 provides a graph of the vertical line segment drawn as an implicit plot with the implicitplot command from the plots package.



Figure 3   Graph of the vertical line x=1 drawn as an implicit plot

For more information on these methods, see plot details and parametric plot

Figures 1 - 3 all require some mathematical insight on the part of the user, who must correspondingly implement some appropriate Maple construct that reflects that view of the vertical line.  Now what happens when the user naively tries to plot x=1 interactively via the Context Panel?  Select the equation x=1 and from the context-sensitive operations in the Context Panel, select Plots>2-D Implicit Plot>x,?.



Figure 4   Use of a context-sensitive operation to plot the vertical line x=1


The result is shown in Figure 4. You can obtain the graph through the Context Panel as well as by using a command.  A final way to graph a vertical line is using the Plot Builder.


First, launch the Plot Builder from the Tools>Assistants menu. In the Expressions section, click the Add button, and enter x=1.

Pressing the Accept button enters the equation x=1 into the Expression box and adds the variable x to the Variables box.  See Figure 5.


Figure 5   Specify the expressions and variables

Press OK. The Plot Builder panel appears.  For plot type, select 2-D implicit plot.  Again, you get the graph of the vertical line.  You can use the Plot Builder to further customize the plot, if desired.


Figure 6   The Plot Builder graphs the line as a 2-D implicit plot

Controlling the Labeling of an Axis


Using the Context Panel


Consider the graph of sinx.  On the horizontal axis, the default range (x=2 π..2 π for a trigonometric graph), default tickmarks, and default labels are shown.


Figure 7   The default plot of sinx


If you want to to change the tickmarks and labels on x-axis to whole number multiples of π, you can do so after the graph has been drawn.


Click on the graph to select it, then in the Context Panel choose Axes>Properties.... (You can also access this from the Plot menu.)  The Axis Properties box is shown in Figure 8.


Under the Horizontal Axis tab, clear the box for Let renderer choose tickmarks, and instead select Custom Spacing (1.0) and Multiply by Pi.  The modified graph is shown in Figure 9.




Figure 8   The Axis Properties

Figure 9 Modified graph with π in the labels



Graphing Efficiently: Return a Command You Can Reuse

Although creating one plot through the Plot Builder is convenient, if you are creating many plots, this can become a tedious way to create the modifications you want.  One tip for more efficient graphing is to use the Plot Builder once, and then extract command with all the settings you selected.


In the Plot Builder, you can opt to show the command used to create the plot.  This provides a way to learn the way to specify these options directly to the plot command.  If you intend to graph numerous similar functions with the same plot settings, this is an efficient way to do it.  


For example, here we plot an ellipse using the Plot Builder, and return the command.  We then modify the command to plot two additional graphs.


Use the Context Panel to launch the Plot Builder for your expression.  In this example, we will graph x249+y29=1.

In the Plot Builder panel, select 2-D implicit plot for the plot type.  Select show command to see the plotting command. To force the axes to use the same scale, under 2-D Options, for scaling select constrained.


The result is shown in Figure 11.


Figure 11   The plot and command returned from Plot Builder


Now, you can copy and paste this command on a new line (ensure you are in 2-D math mode when you paste it)  to create a graph.  You can modify the command to create variations.  For instance, you can graph x29+y29=1 or x249y29=1 without having to go through the Plot Builder steps again.


1. Graph of x29+y29=1, a circle.

plots:-implicitplotx29+y29=1, x = 10.0 .. 10.0, y = 10.0 .. 10.0, scaling = constrained

2. Graph of x249y29=1, a hyperbola.

plots:-implicitplotx249y29=1, x = 10.0 .. 10.0, y = 10.0 .. 10.0,scaling = constrained

See Also

 plot, plot/options, plot/parametric, plot/tickmarks,  plots[implicitplot], plottools[line], trig


Go to Maple Portal