![]() |
Intro to Scientific ComputingPHYS 27/193Physics Department University of the Pacific |
Now we are getting down to it.
What we have done so is good for learning mathematics, i.e. plotting beautiful functions and seeing what they look like. We even learned to solve an equation "Graphically".
But as scientists we are often trying to learn something
about physics from an experiment that we have done.
In other words, we have some data and we what to understand what
theoretical model
or mathematical relationship is indicated by
this data.
We can often tell that by just looking at a plot of the data,
or
in fancier language: visualizing the
data. That's what we'll do now.
First, we need some data.
Open Emacs and enter the following data
(you should be able to cut and paste it from your browser window).
It is important that you have columns of ASCII (or text) numbers
with "white space" in between them.
"White space" means either a single or more SPACEs (as when you hit the space
bar), or a TAB.
0.0 0.24 0.5 0.66 1.0 1.56 1.5 2.05 2.0 2.80 2.5 1.74 3.0 2.54 3.5 3.36 4.0 4.61 4.5 4.44 5.0 5.61 5.5 4.68 6.0 6.72 6.5 5.97 7.0 7.07 7.5 8.38 8.0 7.44 8.5 9.34 9.0 8.12 9.5 9.97 10.0 10.54 |
start gnuplot.
Type:
gnuplot> plot "data1.dat" |
Be sure to include the " " s.
You need to do
this anytime you refer to a "file" or "folder" on your disk,
such as a data file, as I have shown in this sentence.
Your plot should look like this:
One of the first things I notice is that the + in the uppermost right corner is not one of the data point in the file! That's because it is the plot symbol in the key, which in this case, is confusing since it is near other data points.
There are several ways to change this. The simplest is to just move the key:
gnuplot> |
Ah. Much better. You could also out a box around the key; remember how? (see Gnuplot: Page 1).
Those points are a little small. Let's change them. This time do the plot with the "with" option:
gnuplot> |
Now we have
gnuplot> |
Isn't that a whole lot easier? Try changing the "pointtype (pt), the "pointsize" (ps), and "linecolor" (lc), and see how your plot changes. You can see the various line/point types and colors by typing test. This will send a test pattern to the screen and show the things available to your screen.
gnuplot> |
To see the options available to the with command, type help
plot with at the gnuplot> prompt. You'll have to hit
[SPACEBAR] to page through the help pages and get back your
gnuplot> prompt.
You've learned a fair amount already!