
Locus
Another exclusive Foundation RISCWorld application
Exercise 7. Data Sets.
One of the most powerful aspects of Locus is its ability to deal with imported sets of numerical data in two variables. You can import data in one of three formats.
- Text
- CSV
- SID
There are various ways these data sets can be produced both from within Locus and by other means. I shall describe how to create these data sets shortly, but first let us see how they are displayed.
Look in the directory 'Data Files' which accompanies Locus and find the CSV file 'SpanHeight'. This is a small data set which examines the correlation between the arm span and height of a few pupils. Now make sure that auto-scaling is on and drag the file 'SpanHeight' onto the main window.
You will notice that the axis titles have changed to show the headers for each of the variables in the data file and that Locus sets the scale so all of the points are plotted.
This is may not be the best scale to analyse the data so you may wish to alter the scale to see the data better.
- Turn off auto-scaling
- Change the scales as follows:
xmin=1200
xmax=1900
ymin=1200
ymax=2000
- Click on the <Plot> button.
You may wish to change the appearance of the data set and to do this you must to go to the 'Effects' item in the main window menu. Click MENU over the main window and click on the item 'Effects' on the menu which will appear. This opens a dialogue box which enables you to set the Locus display. For a full description of this please see the manual.
The entries half way down the box lets you set the colour of the various objects that Locus deals with, axes, graphs etc. In the right hand column you will find five entries called Mark 1, Mark 2, etc.. These refer to data sets. It is important to note that you are not restricted to displaying only five data sets simultaneously, it is just that there are only five colours available and so these will be used in turn, repeating after all five have been used. In fact the only restriction on the number of data sets that Locus can display is in the size of your computer's memory.
Click with MENU on the Mark 1 colour icon and select the colour you want to use.
Towards the bottom of the Effects dialogue box is the section which defines the Marks, this has two items. Mark style, which controls the shape of the mark, and Connect Marks, which controls whether the marks are joined together. To change the Mark style -
- Click <Menu> on the mark style menu icon.
- Choose a different mark
- Press on <OK> to effect your changes.
Producing Data Set Files
Firstly they can be produced using a spreadsheet. Most Spreadsheets can export data in CSV or SID format. Another method is to write files manually using a text editor such as Edit, Zap or StrongEd. The structure of the files that Locus will recognise is as follows
- The top line consists of the titles you want to appear on the horizontal and vertical axes. Text may be enclosed in inverted commas. For example this line in the example is "Arm Span","Height" but could have been Arm Span,Height.
- The data follows, two items on each line, an x-coordinate and a y-coordinate, separated by a comma.
- You must ensure is that if you are writing the data to a text file you should press RETURN at the end of the last line of data.
The second way of generating these files is to save them from Locus. This may seem a little pointless at first but as you will see later there are uses for this.
As a simple example let us plot the graph of y=x² as we have done above.
- Set auto-scaling to 'on' and a domain -4<=x<=4.
- Click MENU over the main window and move the mouse to the right to the sub-menu File.Save.
- Move down to the item CSV and move the mouse to the right and a save dialogue box will open.
- Fill in the Start,End and Step fields as -4,4,0.1 respectively.
- Change the name to 'xsqu'
- Drag the file icon to a filer directory window.
- Click on the clear screen icon
- Drag the CSV file onto the main Locus window.
- Open the effects dialogue box and change the Mark style to Dot, select the Connect marks option icon and click on the <OK> button.
The resulting curve should look almost identical to your original graph of y=x². The reason for this more complex method is that you can now apply different transformations to your graph in either matrix or described form in order to analyse the function. This is the subject of Exercise 9.
Foundation RISCWorld

|