update 2001/9/11
![]() | |
![]() |
![]() ![]() ![]() ![]() |
![]() |
Those three experimental data sets can be approximated by y = -0.01687 x + 1.3512. This function is plotted with the data with is stored in a data file, plotexp.dat. To access each data block in one datafile, use the index keyword to specify the block to be drawn. You can specify the first block by index 0:0 or index 0 . The third block is pointed by index 2. To combine the first and second blocks, use index 0:1 . To plot data with error bars, use with yerrorbars . This requires the error data at the third column in the file, which is specified by using 1:2:3 . If an error is given in percent (%), using 1:2:($2*$3/100.0) converts them into an absolute error.
![]() When your command line is too long, put "\" at the end of line, then you can continue. Gnuplot recognizes short keywords, for example "w" is "with", "i" is "index", and so on. In addition, you can omit a file name if the same file is used, just like the example above. In the next two lines after the first "plot" command line, a short form "" can be used instead of "plotexp.dat". |
Each experimental data was measured by three different experimentalists. Their names are, "A. Smith" for the fist one, "B. Smith" for the second, and "C. Smith" for the third, and they carried out the experiments in 1992, 1993, and 1999.
![]() |
To overlay a function and experimental data, the fitted linear function, f(x) = -0.01687*x +1.3512, is defined first.
![]() In the above case, color number used for each measurement is shifted because the linear function was inserted at the top. |
Those experimental data are distinguishable by colors when the graph is on your screen. However, to convert it into Postscript you may see a strange symbol as below. In the Postscript terminal the line number 1 is solid, but the number 2,3, and 4 are dashed, dotted lines. So that you get a dashed error bar ! ![]() I suppose nobody likes such a funny symbol. Let's define the all lines solid, and each measurement has a distinct symbol.
The first line defines the linestyle No.1 as the solid line with width of 3. The second to fourth lines define the linestyles those are used for experimental data. The line is solid, but the symbols of No.7, 8, and 9 are used.
![]() |
In the above graph, a legend for the fitted line was removed with the notitle keyword. Although it is difficult to see this figure since all data points and the line is red, this inconvenience will disappear when it is printed. Now, make labels for the X and Y axes. The name of X axis is "Energy [MeV]", while the Y axis is "Cross Section [b]". To set those names, use set xlabel and set ylabel . The replot command invokes the "plot" command you typed before, so that you don't need to type the long command again.
![]() |
Then, adjust the ranges for X and Y axes. For Y axis, setting the minimal value of 0 and the maximal of 2 works fine. There are too many measured data points near X=0. We take logarithm to magnify there. The least X value is set to 0.01, while the largest value is 20. The set logscale {x|y} command controls the logarithm.
![]() |
Finally, put graduations on the axes. The X axis is log, so you can leave it. The Y axis has a tic with an interval of 0.5. Let's set the interval 1, and divide it by 10. In addition, we draw a grid in the graph. The grid is shown at the major tics where you see figures.
![]() |
Now we have completed. With the Postscript driver, specify an output file name, and replot, you get a Postscript graph. Before quit gnuplot, save everything in a file
A Postscript printer can generate a printed graph. Postscript browsers like ghostscript or gv, can display the content. The image below is made with gv. ![]() It is not clear to see because the image size is small. Anyway, the No.7 symbol is the filled circle, No.8 is the open triangle, and No.9 is the filled triangle. The kind of symbols and lines depends on the terminal. There are a number of symbols when a Postscript terminal is used, but a limited number of those are practically used for a plot of experimental data, those are circle, triangle, square, and so on (both filled and open). Here is the style numbers of those symbols.
|
![]() | |
![]() |
![]() ![]() ![]() ![]() |
![]() |