THE UNIVERSITY OF BRITISH COLUMBIA
 
Physics 210 Assignment # 4:
 
PLOTTING
 
SOLUTIONS:
 
Tue. 28 Sep. 2010 - finish by Tue. 05 Oct.

In this assignment you will take the following data file (below)1and generate the plot on the right (or as close as you can manage) using several different plotting applications.
data.db   

TITLE
Just Some Typical Data
LABELS
Data Set Number
Independent Variable "X"
Dependent Variable "Y"

DATA DSN X Y
1,,, -20,1,2, -1.9,0.1,0.3,
1,,, -12,1,3, -1.2,0.2,,
1,,, -10,1,, -0.95,0.05,0.1,
2,,, -1,0.5,, -0.05,0.05,,
3,,, 5,1,2, 0.55,0.1,0.05,
3,,, 7.5,0.5,, 0.8,0.2,0.15,
3,,, 10.5,1,0.5, 1.1,0.1,,
3,,, 15,1,, 1.6,0.1,,

Create your /home2/phys210/<you>/a04/ directory and the subdirectories muview, gnuplot, extrema, matlab and octave, where you should store any files used to make the same plot (or as close as you can get) with the respective applications. With each application, see if you can enter data with asymmetric uncertainties ("error bars") and plot them on a simple graph like that above. If this proves too difficult, use the RMS (square root of the average of the squares) of the positive and negative uncertainties to plot symmetric "error bars". You will need to edit data.db into differently formatted ASCII "data files" from which each program can read in the data; give those files obvious mnemonic names like matlab.dat;2if possible, each file some should include some comment lines explaining what it is and how it is meant to be used. (Most applications allow comments in some form.)

In most cases (except muview) you will also be able to make a "command file" that tells the application to read in the data file, prepare and execute the plot, etc. It should also have some obvious mnemonic name like plot.cmd or plot.gp or plot.m (some applications may require a special extension for command files).

Make a plot.ps or plot.pdf file in each case and store it with the other files for that application.

Within reason,3you should learn how to control the æsthetics of your graph (things like limits, "tick marks", font sizes, symbol shapes and sizes, zero-axes, axis labels, title, captions and so on. There are certain standards for "publication quality" plots. See for instance http://authors.aps.org/STYLE/ or any copy of THE PHYSICAL REVIEW to get an idea of what is expected. (Most of it is "just common sense", but Einstein taught us how unreliable "common sense" can be. :-)

The "freeware" applications muview and extrema were developed at TRIUMF; their use will be demonstrated in class so that you should have no trouble producing the required plots with them. Both run on both Linux and Windows.

Because muview is a Java applet, your $HOME directory must contain the file .java.policy. (This file is also needed to use muview under Mac-OS/X or Windows -- see http://musr.org/muview/requirements.html. On your Mac it goes in your $HOME directory, but in Windows its proper location is mysterious -- it depends on which version of Windows you are running.)

The other freeware applications gnuplot and octave can be found on any Linux distribution and are also available free for Windows.

The very expensive proprietary application matlab is available on hyper for your use; it comes with a fancy GUI (Graphical User Interface), voluminous help files, excellent tutorials (see the "Manuals" page on our Website) and slick graphics - unlike its freeware cousin octave, which has only simple help commands and uses gnuplot for its graphics. But octave is free and Open Source.4

ANSWER: My best efforts, using the scripts in the indicated directories, are shown below.
~phys210/HW/a04/muview/ : (see p. 1).

The others require a different format for the data file; my version, db.dat, looks like this:

1 -20 1 2 -1.9 0.1 0.3
1 -12 1 3 -1.2 0.2 0.2
1 -10 1 1 -0.95 0.05 0.1
2 -1 0.5 0.5 -0.05 0.05 0.05
3 5 1 2 0.55 0.1 0.05
3 7.5 0.5 0.5 0.8 0.2 0.15
3 10.5 1 0.5 1.1 0.1 0.1
3 15 1 1 1.6 0.1 0.1


~phys210/HW/a04/gnuplot/:

\epsfig{file=data-gnuplot.ps,width=0.6\columnwidth,angle=-90}


~phys210/HW/a04/extrema/:

\epsfig{file=data-extrema.ps,width=0.7\columnwidth,angle=0}


~phys210/HW/a04/matlab/:

\epsfig{file=data-matlab.eps,width=0.8\columnwidth}


~phys210/HW/a04/octave/:

\epsfig{file=data-octave.eps,width=0.7\columnwidth,angle=0}


I consider none of them entirely satisfactory.
(except maybe
muview  :-)



Jess H. Brewer 2010-10-01