Graphix    Automated data plotting

by Andrew Benson


The application Graphix creates high quality Draw format graphs from CSV file data. It was designed primarily for displaying scientific results, but can be put to numerous other uses.

The application will take a file of data (CSV format, which can be saved from most spreadsheets or created manually) and convert it into a graph complete with axes, labels and error bars. Also, Graphix can perform a number of different kinds of regression on the data. This produces a 'line of best fit' to the points on the graph which is then drawn onto the graph. Graphix will also calculate the equation of the line of best fit and the accuracy of the fit. All of this information can be included in the final graph file.

The Draw files produced by Graphix can then be loaded into Draw for further editing or imported into a DTP application or anything else that handles Draw files.

USING THE APPLICATION
To use Graphix you will firstly need to create the data from which you wish to make a graph. If you have a spreadsheet program then the data can be entered into that and then saved as a CSV file. Graphix expects each line of the file to contain one set of coordinates (x coordinate then y coordinate) separated by a comma. If you don't have access to a spreadsheet you can instead use Edit or any other text editor to create such a file. To do this simply create a file of filetype &DFE (see the relevant manual for how to set the filetype). Then simply enter your data as described above, pressing return after each set of coordinates. You should end up with a file which might look something like this:
	1.3,45.9
	3.1,23.34
	5.9,78.0
	-4.2,24.5
Save this file into a directory viewer.

Once the data file is created you can load Graphix by double-clicking on its icon in the disc directory viewer or clicking on the icon above. This will open a directory display showing some example CSV files.  The Graphix icon will also appear on the right hand side of the icon bar. Clicking Menu over this icon opens the main menu. This contains six entries which are described below.

Info
This leads to a standard program information box.

Font
This leads to a submenu listing all of the fonts available. Clicking on a font here will place a tick by the side of the entry. This is then the font that will be used to put the labels, title and numbers on the graph.

Options
Selecting this entry will open the options window, described below.

Regression
This leads to the Regression window, which is described below.

Save
This is initially greyed out as there is no file to start with. Once a data file has been processed this entry leads to a standard save box which allows you to save the graph file.

Quit
This will quit Graphix if selected.

The options window allows you to specify certain parameters which concern how the graph will be displayed.

At the top of the window are three writable icons in which you can enter the title and axes labels that you want to appear on the graph. Below is an icon which shows the current font size used to display the labels and numbers on the axes. To change this simply click Menu over the menu icon to the right. This displays the font size menu. You can use this to choose a font size of 6, 8, 10, 12, 14 or 20 points.

The Display section allows you to decide what information will be displayed on the graph. Simply click on the relevant option to switch it on or off. The options areas follows:

1. If the Error bars switch is set to on then Graphix will expect to find extra information in the data file. Each line should contain the x,y coordinates as described above followed by the x,y errors. Errors should be given in absolute terms, not as percentages. For example a line might look like:
	45,186,5.2,9.4
The error bars will then be plotted on the graph.

2. If Regression line is switched on then Graphix will attempt to fit an equation to the data. The type of equation used can be selected from the 'Regression' window. The equation line (or curve) will then be drawn on the graph.

3. If Statistical error is switched on then Graphix will calculate the average deviation of each point from the line of best fit. This error bar will then be shown on the graph and labelled 's'.

4. If Regression data is switched on, Graphix will include, to the right of the graph, information on the type of equation which it tried to fit to the data. This will show the general form of the equation, the values of the constants and their associated errors, the value of the statistical error, s, and the value of the correlation coefficient, r. This last item is a measure of how well the equation was fitted to the data. The value of r is always between 0 and 1, 1 meaning a perfect fit and 0 meaning a complete failure to fit.

At the bottom of this window are four buttons. Cancel will undo any changes you have made in the window and close it. Save allows you to save the current options so that they will be used as defaults. Apply is initially greyed out. Once a file has been processed Apply becomes available. If some of the options are changed, clicking Apply will apply the changes to the data currently in memory, which saves having to reload the data every time you wish to make a change. OK simply confirms any changes you have made and closes the window.

The Regression window is available from the main menu. It contains four buttons which allow you to choose between four different types of equation which can be fitted to the data. The form of the equations are shown on the right hand side of the window. In each, x and y are the data values. m & c or A & B are constants which Graphix will determine to give the best fit to the data. Simply click on the type of equation you want to have fitted to the data.

Once you have set whatever options you wish, simply drag the data file onto the Graphix icon. The hourglass will appear for a few seconds or longer if the data file is very large. When the hourglass vanishes the graph has been created and is ready to be saved from the save box which appears. Use the save box from the main menu to save the file in the normal way. The file can then be used in Draw or a DTP package.

NOTES
Graphix interacts with Interactive Help to offer brief help on all of the options and icons. This is provided by Acorn's Help program which can be found on Apps disc 1 for RISC OS 2, and in the Apps directory if you have RISC OS 3.

All regression calculations except linear regression require the calculation of the natural logarithm of some of the data. As values of zero or less have no logarithm, the regression will fail if it meets any such values. If this happens Graphix will display an error message. The graph will still be created, but there will be no regression line or data and no statistical error bar.


 Copyright RISC User 1994
