Plotting Tips: Vertical Lines and Axis Labels
Go to Maple Portal Maple Portal for Math Educators
|
Introduction
|
|
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:
•
|
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-menus 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. Once you are satisfied, return a plotting command that can be reused and modified. With the Plot Builder, your trigonometric plots can be easier to read and convey more useful information.
|
|
Initializations
|
|
>
|
|
>
|
|
|
|
Plotting the Graph of a Vertical Line
|
|
In the -plane, the graph of the solution set of the equation 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 .
>
|
|
|
>
|
|
|
Figure 1 Graph of the vertical line segment by specifying its endpoints
|
Figure 2 Parametric plot of the vertical line segment
|
|
|
![``](/support/helpjp/helpview.aspx?si=3847/file02185/math113.png)
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 drawn as an implicit plot
|
|
|
For more information on these methods, see plot details, parametric plot, and implicit 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 interactively via the context menu? Right-click the equation and from the context menu, select Plots>2-D Implicit Plot> .
The result is shown in Figure 4. You can obtain the graph through the context menu 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 .
Pressing the Accept button will enter the equation into the Expression box and add the variable to the Variables box. In the Variables section, click the Add button and add the variable . Press Accept. Figure 5 shows the completed Specify Expressions dialog.
|
Figure 5 Specify the expressions and variables
|
|
|
Press OK and then press Plot in the main Plot Builder window. Again, you get the graph of the vertical line.
|
Figure 6 The Plot Builder now draws the plot as a 2-D implicit plot
|
|
|
|
|
Controlling the Labeling of an Axis
|
|
Using the Context Menu
Consider the graph of . On the horizontal axis, the default range ( for a trigonometric graph), default tickmarks (at multiples of ) and default labels are shown.
>
|
|
>
|
|
|
Figure 7 The default plot of
|
|
|
We want to change the tickmarks and labels on the -axis to be only at whole number multiples of One method is to modify the graph after it has been drawn by editing the axis properties for the plot.
Click the graph to select it, then from the Plot menu choose Axes>Properties.... (You can also access this from the context menu for the plot.) 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
|
|
|
Using the Plot Builder
When graphing with the Plot Builder, you can also access these options. Use the context menu to launch the Plot Builder for your expression. Again, we use the example .
In the Plot Builder, press the Options button to access the dialog for plot options, then select the Advanced Settings option under Axes on the lower left. In the Advanced Axis Settings dialog box, open the drop-down listing under Tickmarks for the -axis. Select spacing(Pi, 0).
|
|
Figure 10 On the left, click Advanced Settings in the Axes box; on the right, in the -row of the Axis box, click the down arrow in the Tickmarks column and select spacing(2, 0), the last item in the drop-down list.
|
|
|
Press the Apply button and Plot.
|
|
Graphing Efficiently: Return a Command You Can Reuse
|
|
In the previous example, a plot was created through the Plot Builder. If you are creating many plots, this can become a tedious way to create the modifications you want. For more efficient graphing, you can use the Plot Builder once, and extract command with all the settings you selected.
When exiting the Plot Builder, instead of returning a plot, you can opt to return 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.
Here are the steps to create the same plot as in the previous section and then to return a command from Plot Builder:
Use the context menu to launch the Plot Builder for your expression, such as .
In the Plot Builder, press the Options button to access the dialog for plot options, then select the Advanced Settings option under Axes on the lower left. In the Advanced Axis Settings dialog box, open the drop-down listing under Tickmarks for the -axis. Select spacing(Pi, 0).
Press Apply and then Command.
The result obtained from choosing Command instead of Plot is shown in Figure 11.
![sin(x)](/support/helpjp/helpview.aspx?si=3847/file02185/math515.png) ![->](/support/helpjp/helpview.aspx?si=3847/file02185/math522.png)
|
Figure 11 The 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 without having to go through the Plot Builder steps again.
Some final illustrations of graphs obtained by modifying this command.
1. Graph of and .
2. One period of the graphs of and with constrained scaling.
3. Labeling every
For more information on tickmarks, including how to place one tickmark at a fixed location and then draw other tickmarks relative to that point, see plot/tickmarks.
4. Using the Plot Builder to play with plot settings and preview the graph can be helpful with discontinuous graphs such as . When satisfied, return the command.
![tan(x)](/support/helpjp/helpview.aspx?si=3847/file02185/math648.png)
![plot(tan(x), x = -10 .. 10, discont = true, tickmarks = [spacing(Pi, 0), default], view = [DEFAULT, -10 .. 10])](/support/helpjp/helpview.aspx?si=3847/file02185/math662.png)
After returning the command from the Plot Builder, copy into a 2-D math region and execute.
To learn more about the options shown here as well as other options accepted by the plot command, see plot/options.
|
Go to Maple Portal Maple Portal for Math Educators
|