Preparing Graphs for Presentation

Annotating Graphs for Presentation

Suppose you plot the following data and want to create a graph that presents certain information about the data:

x = -10:.005:40;
y = [1.5*cos(x)+4*exp(-.01*x).*cos(x)+exp(.07*x).*sin(3*x)];
plot(x,y)

This figure shows the graph created by the previous code.

Now, suppose you want to save copies of the graph by

To obtain a better view, zoom in on the graph using horizontal zoom.

Enable zoom mode by clicking the Zoom tool on the figure toolbar, and then right-click to display the context menu. Select Horizontal Zoom (2-D Plots Only) from Zoom Options. You can reverse your zoom direction by doing Shift+left-click, or using the context menu.

Left-click to zoom in on a region of the graph and use the Pan tool to position the points of interest where you want them on the graph.

Label some key points with data tips using the Data Cursor tool . Left-clicking the line moves the last datatip you created to where you just clicked. To create a new datatip, press Alt+click or use the tool's context menu. See Data Cursor — Displaying Data Values Interactively in the MATLAB Graphics documentation for more information on using datatips.

Next, use the Figure Palette to annotate the plot. Choose the Double arrow tool in the Annotations section to draw a line between two datatips, as shown in the following figure.

Now, add a text box, also using the Figure Palette. You may have to scroll to see the text box icon. Drag out a box, and then type into it. You can stretch or shrink the box with its handles, and center the text with the Property Editor while the text box is selected. You can also use the Property Editor to change the text font, size, style, color, and also the text box line and background colors.

Finally, add text annotations, axis labels, and a title. You can add the title and axis labels using the following commands:

title ('y = 1.5cos(x) + 4e^{-0.01x}cos(x) + e^{0.07x}sin(3x)')
xlabel('X Axis')
ylabel('Y Axis')

You can also add these annotations by selecting the axes and typing the above strings into their respective fields in the Property Editor. The graph is now ready to print and export.

Printing the Graph

Before printing the graph, select File > Print Preview to view and modify how the graph will be laid out on the page. The Print Preview window opens, containing a tabbed control panel on its left side and a page image on its right side.

The Print Preview dialog box provides many other options for controlling how printed graphs look. Click its Help button for more information.

Exporting the Graph

Exporting a graph is the process of creating a standard graphics file format of the graph (such as EPS or TIFF), which you can then import into other applications like word processors, drawing packages, etc.

This example exports the graph as an EPS file with the following requirements:

Specifying the Size of the Graph

To set the size, use the Export Setup dialog box (select Export Setup from the figure File menu). Then select 4 from the Width list and 3 from the Height list.

Specifying the Font Size

To set the font size of all the text in the graph, select Fonts in the Export Setup dialog box Properties selector. Then click Use fixed font size and enter 8 in the text box.

Selecting the File Format

After you finish setting options for the exported graph, click the Export button. A standard Save As dialog box opens that enables you to specify a name for the file as well as select the type of file format you want to use.

The Save as type drop-down menu lists a number of other options for file formats. For this example, select EPS (*.eps) from the Save as type menu.

You can import the saved file into any application that supports EPS files.

You can also use the print command to print figures on your local printer or to export graphs to standard file types.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS