In this section you'll be introduced to some packages available under Linux that are useful for scientific computing.
A handy Linux package for plotting data using a graphical user interface (GUI) is xmgrace. It is not available in the Linux lab in the Maths building, but you may encounter it on desktop machines in the CSC. Therefore, you should defer looking through these quickstart instructions here until you are logged on to a machine that has this package installed (use locate or just type in the command 'xmgrace' to see if it is available).
This package is invoked by typing xmgrace at your shell prompt. It is usual to also supply the names of the files that contain the data you wish to plot. For example, here are two data files for download, showing change in energy with respect to bond rotation in a molecule data_file1.txt and data_file2.txt. Note: the data files do not have to end in .txt by convention. Download these files and then plot these data by typing
xmgrace data_file1.txt data_file2.txt
Note that you can load anything from one to many data files.
You should get a window showing two plots, one in black and one in red. The range spanned along the ordinate axis should run from 0 to 80, and the abscissa should run from -200 to 200.
Now consider how you could change the appearance of this plot. Most of the tools you will need are located under the "Plot" menu. Take a look at the options under this menu.
Adding a title
Choose the "Graph Appearance" option, and type your title into the box labelled "Title", then click on Apply. You will notice that there are many other tabs in this popup, such as "Titles" (where you can change the font, etc, of your title), "Frame", "Leg. Box", etc. Have a look and see what you can change under these options. Click "Accept" when you're done.
Axis labels, plot range and tick marks
Choose the "Axis properties" option, and choose "X axis" or "Y axis" in the "Edit" menu. Type in your label in the box marked "Label string" and click on "Apply". You will notice that there are many other tabs in this popup, such as "Axis label and bar" (, "Frame", "Tick labels", etc. Have a look and see what you can change under these options.
You can also change the axis range under this option. Just change the numbers in the boxes marked "Start" and "Stop", and you can also change the tick spacing by changing the numbers in the boxes marked "Major Spacing" and "Minor Ticks".
As an exercise, try limiting the range along the X Axis from -180 to 180, and generate ticks every 30 units
Click "Accept" when you're done.
Data appearance - lines, symbols and legend labels
Choose the "Set Appearance" option. In the "Select set:" box you will see two items, one for each data set you have loaded. Click on the first item (should appear as (+) G0.S0). Now look at the information in the "Line Properties" box - you can change this information to: change the style of line (it will be continuous at the moment - look at the pull-down menu for dotted, dashed, etc line styles), change the width of the line (it will be at width 1 at the moment, try bumping it up to 2), change the colour of the line (it will be black at present). Click on "Apply" when you want to see your changes to your plot.
While also in the "Set Appearance" option, you can also include symbols for your data points. The default is to not show symbols. You can change this by looking in the "Symbol Properties" area, and viewing the "Type" menu. Change your plot so that you have diamonds for dataset1 and squares for dataset2.
Finally, for each selected dataset, you can type in a string that will appear in the Legend as a label. Just type your label in the box marked "String" and click on "Apply" for each selected data set.
Again, you will see other tabs in the "Set Appearance" option, such as "Symbols", "Line", and so on. Have a look to see what things you can change here.
This is a package for viewing postscript files. Here is a postscript file to upload - actually a map of the campus of the ICTP in Trieste, campus.ps. To view this file, at the prompt type
This will bring up a window showing you the file. You can left-click on the numbers in the left hand column to move between page numbers (in this case there are only 2 pages). If you middle-click on any of these numbers, they become marked. This is useful for when you want to print only a selection of pages from the document, using the "Print Marked Pages" option from the File menu. Just middle click again to unmark a page.
The menus running across the top of the ghostview window are fairly self-explanatory - have a go and making some changes such as document size and orientation.
Latex is used to create scientific documents. It is not WYSIWYG, but involves creating a source file to typeset your document, which you can then process and turn into a postscript or a pdf file. latex has a very useful way of including a bibliography or references list, using an associated program called bibtex.
It's best to learn latex by example. To help you with this, here is a download of a tarball of latex files latex-tute.tar. Start by going to your top directory. Make a directory called latex. Go into latex/. Make a directory called EXAMPLE and go into EXAMPLE/. Extract the files from the bundle in the directory EXAMPLE. There should be plenty of files in your EXAMPLE directory now.
Using emacs, open the file LATEX-README. Follow the instructions in this file.
This is a package creating a composite image. It is not available in the Linux lab in the maths building, but you may encounter it on desktop machines in the CSC. Therefore, you should defer looking through these quickstart instructions here until you are logged on to a machine that has this package installed (use locate). When you are in this situation, to invoke this package, type
On the left-hand side in the top half of the window there is a column of buttons, corresponding with drawing circles, polygons, straight lines, and bezier curves just to name a few. Basically the buttons in this area correspond to ways you can create an image. To draw a circle, say, click on the circle button. Then left-click onto the canvas and draw out the circle by moving your mouse. Take note in the top right hand corner of the xfig window when you are drawing a figure - you will see three rectangles. These three rectangles from left to right represent the left, middle and right mouse buttons. Near each of these rectangles you will see a comment such as "set radius" (seen on the left hand button while drawing the circle). This tells you that when you are happy with the radius, left click your mouse. If, while drawing the circle, you wish to cancel your action and start again, the mouse guide tells you that a right-click will "cancel". Experiment with some of the other drawing options - the large T for example is for writing text.
One of the more important buttons in the image-creation panel is the "Picture" button. In this mode, you can import an image, using any of a number of image formats. Click on this button. You now have to mark out a square on the canvas where you'd like the image to go. Look at the mouse guide - it will say to mark the "corner point" with the left mouse. Then drag the mouse to mark out your rectangular area. While your mouse is dragging, your mouse guide tells you that a left-click will give the "final point" (meaning the bottom right hand corner of the area). Once your imported-image-area is established, a window will pop up. Type in the name of the image you'd like to import. You could use the file NEWfig.eps from the latex example. If your desired image is not the PWD, you should type in the full path name. Then hit the "Apply" button located in the top of the popup window. The image should now be imported onto the canvas - but it may be a strange-looking aspect ratio! To correct this, click on the button "Use original size" located in the bottom of the popup window. Then hit the "Apply" button again. This figure should now look OK. In that case, click "Done".
In each case of image creation/import, when you successfully create an object, you will see one or more small squares attached to it. Don't worry, they don't show up in the finished product! These squares are anchors from which you can perform operations on these objects.
Operations on images
On the panel on the left-hand side on the bottom half, there are a series of buttons corresponding with image operations. Some should be obvious, such as "move", "copy" and "delete". To perform any of these actions, click the relevant button, and then using your left mouse button, click on one of the small squares attached to your image. Follow the mouse guide for clues about what to do next.
Making compound images
Some of the buttons are not so obvious. One of the more helpful buttons is "Glue" (the button in the top left hand corner of this region. When you have a collection of images that you'd like to glue together into one composite image, left-click on this button. Again, look at the mouse guide. The left mouse button is marked with "tag object" - this means to use the left-click to successively tag all images you want to include in your image. Each time you tag an object, the associated small anchor squares will turn black. When you have selected all your images, the mouse guide indicates that a right-click will yield "compound tagged", meaning that it will create your composite image. Upon formation of the composite image, the small squares should move to indicate the boundaries of this new composite image. Application of operations such as "move" will proceed as before, except now you can manipulated the entire collection of images as if it were one image.
To break up your composite image into individual components again, use the "break compound" button, next to the "Glue" button.
Along the bottom of the xfig window there are other buttons, that control various aspects of your session, such as whether you want a background grid ("Grid Mode") to help you allign objects, if when drawing an image you'd like to use thicker lines, or you'd like to fill your drawn polygon with colour and/or shading, or you'd like arrows on the lines that you're about to draw. When selecting the "text" button, you will have the option of changing the font, size and colour of the text. When creating/importing an image, along this toolbar you also have a "depth" button, so you can control which images can overlay others.
Saving and exporting images
Once you've made an image you're happy with, you'll want to do two things. The first is save this image in the xfig format - to so this select "Save As" from the "File" menu, and type in your file name. You may also wish to export this image. To do this, choose "Export" from the "File" menu. A popup dialog box will appear. The first pulldown menu in this box gives you a choice of image formats. Type in your desired file name for this image, then click on "Export".
5. The gimp / Imagemagick
The gimp and Imagemagick are two packages for viewing and manipulating images. They are both menu-driven, much like xfig is. To invoke the gimp, type
To invoke imagemagick, type
Upon starting up, both packages require you to load an image file. In the case of Imagemagick, after the image is loaded, left-click on the image. A popup menu will appear, giving you the opportunity to save the image in a different format, transform the image (rotate, crop, chop), change the colours of the image, etc. In the gimp, this popup menu will appear upon invocation. The gimp has many, many more image manipulation tools, in addition to the tools just mentioned. Try out some of these tools with an existing image.