How to Make Your Plots Zoom

December 20 2007 DJ Clayworth 203
Maple

0

Have you ever plotted a function in Maple and then found that the range you plotted it on wasn't really what you wanted? You can always re-execute the command, of course, but that means working out exactly what the range is for that interesting feature you want to investigate, and if you've made changes to the plot those will be lost. However Maple has the ability to zoom in on a plot interactively, without re-executing the command. The Axis Properties dialog lets you change the range numerically, but you can also do so using the mouse. Go to the plot toolbar and click on the Scale plot axes button (it looks like a red ball with an arrow). If you have an animation you will need to click on the word "plot" above the toolbar to switch from animation to plot toolbar. Now put the mouse in the middle of the plot and drag it. Dragging it down will zoom out, increasing the range; dragging it up will zoom in. The Translate plot axes button lets you 'pan' i.e. move the centre of the axis ranges without changing the range size.

Users of Maple 10 and earlier will remember that these buttons used to let you position the plot within its bounding box. Better drawing of the plots means that this function is no longer needed, so we've re-used them to something better. Incidentally, zoom and pan work completely differently on 3D plots. There they actually change the viewing position of the plot, and not the axis range, so this little trick doesn't work. If you did the zoom and pan as above on a plot created with a plot command, it's only partly useful. The range changed, but anything in the plot stayed the same. If you zoomed out the curve didn't expand to fill the new range, and if you zoomed in the curve didn't get more detailed. If you zoomed in far enough your plot starts to look like straight line segments. The reason for this is that the function was sampled at a density, and over a range, that made sense for the original axes. For a normal plot Maple doesn't know how to recalculate for the new range. That's where smartplots come in. Smartplots are a little used feature of Maple. At first glance the smartplot command looks like a dumbed-down version of the plot command. It won't take the same variety of function inputs, and you can't specify options on the command line. But its big strength lies in exactly what we're doing. If you create a plot with a smartplot command then when you zoom or pan the plot, like we did above, the function will resample itself to fit the new range. You can zoom in on that interesting feature of the curve and get more detail. There are actually two more ways to create a smartplot, and you may have created one without knowing it. If you use a context menu to create a plot using the Plots/2D Plot menu item then that plot is automatically a smartplot. (That doesn't apply to the PlotBuilder - it creates regular plots). Also if you take an expression and drag that onto a plot that curve becomes smart and will resample itself when the range changes. That doesn't make other curves already in the plot smart, and it doesn't apply if you drag a curve from one plot to another. Smartplots exist in 3D as well, and function in the same way. Because zoom and pan don't change the range they are not quite as useful, but if you change the range with the axis properties you can achieve the same effect. Just like "clickable calculus" lets you do simple calculus without having to write Maple commands, you should be able to do simple plotting without knowing the Maple plot commands. That's a goal for making Maple easy to use, and here's how you can do it.

  • Write the function you want plotted by command, or using the 2D editor.
  • Use the context menu to create a plot from it.
  • Use zoom and pan to adjust the range to what you want it to be, while the plot resamples to each new range.
  • When you are happy with the range, use the plot menu to change the look of the plot - change the line thickness or color, add a title or axis label, add annotations or change the tickmarks.
Please Wait...