Prototyping with tools

Next: Phase Plots With Maple Up: Drawing Graphs Previous: Octave   Index

Click for printer friendely version of this HowTo

## Octave With Grace

This is a step by step guide to how Figure 3.7.1 was created.

Get data defining the curve from octave:

octave> x = linspace(0, 8, 100);
octave> y = chisquare_pdf (x, 1);
octave> plot(x, y)  # verify the graph
octave> z = [x', y'];
octave> save -ascii "chi_square1.dat" z
octave> exit


Set the GRACE_EDITOR environment variable: The default editor for Grace data files is Vi. If this is fine with you, you can skip this step. Otherwise, you can either set the variable on the command line:

shell> export GRACE_EDITOR emacs

or edit your shell configuration file. Editing your configuration file has the advantage of setting things up for your future sessions with grace as well.

Now import the data into Grace:

shell> xmgrace chi_square1.dat &


You can modify the X-axis and the Y-axis to display things the way you want them to look by choosing Axis properties from the Plot menu.

Now we want to highlight the area under the curve specified by the chi-square statistic. To do this, we first duplicate the data set. You can do this in a number of ways. Here we will choose Data sets... from the Edit menu. This will bring up a window listing the existing data sets. Click on the dataset to select it. Now right click on the dataset and choose Duplicate from the menu.

We will now edit the duplicate data set to remove all of the points that occur before our chi-square value. We do this by right clicking on the new data set and selecting Edit In text editor from the menu. Now, delete all of the data rows that come before X = 5.76. After you have done this, save the changes to the data, close the editor and click on the Accept button at the bottom of the window.

To color the area the under second, smaller dataset we now select Set appearance from the Plot menu and

• select the second set in the box at the top of the window
• click on the Line tab
• select To baseline from Type menu
• select a nice color and pattern.
• click on the Accept button at the bottom of the window.

We can also add text and arrows to graph with drawing tools by selecting Drawing objects from the Window menu.

To create EPS and PDF files (EPS files are needed to create DVI output and PDF files are needed to create PDF output) select Print setup from the File menu. Now select eps or pdf4.1from the Device menu. Now click Accept at the bottom of the window. Now select Print from the File menu.

Next: Phase Plots With Maple Up: Drawing Graphs Previous: Octave   Index

Click for printer friendely version of this HowTo

Frank Starmer 2004-05-19
>