next up previous contents
Next: 2.3 Fonts and special Up: 2. Plotting 1D data Previous: 2.1 File formats

   
2.2 Making a nicer plot

In the example shown in Figure 2.1 we have simply used the defaults of KUPLOT and plotted the data set directly. The program KUPLOT offers a variety of commands to alter the appearance of the plot itself and the representation of each loaded data set. We are using the same data set 'test.xy' as in the previous example (with added $\sigma$ values) and create the plot shown in Figure 2.2.


  
Figure 2.2: Customized KUPLOT plot
\includegraphics[scale=0.5, angle=270.0]{pl1.2.eps}

The macro file used to create this plot (Fig. 2.2) is listed below. Note, that the line numbers are added for easy reference within this manual and are not part of the actual macro file.

      1  load xy,test.xy
      2  #
      3  achx x-axis [units]
      4  achy y-axis [units]
      5  tit1 \fs KUPLOT demonstration
      6  tit2 Example 2
      7  #
      8  grid on
      9  fnam off
     10  #
     11  skal -2.5,7.5,-4.5,29.5
     12  mark 2,5
     13  #
     14  lcol 1,6
     15  lwid 1,0.5
     16  mtyp 1,3
     17  mcol 1,3
     18  msiz 1,0.4
     19  etyp 1,2
     20  #
     21  sleg 1,"Test data"
     22  sann 1,"Annotation",2,12
     23  plot

In line 1 of this macro we read the data set from file 'test.xy' as in the previous example. The axes labels and the text for the first and second title line are set in lines 3-6. The grid of dashed lines at positions of the major tick marks is enabled in line 8 and the plotting of the filenames corresponding to the data sets in the upper left corner of the plot is switched off (line 9). Next we define the extend of the plot (line 11) to be from -2.5 to 7.5 in the x-direction and from -4.5 to 29.5 in the y-direction. The tick mark interval is set to 2.0 and 5.0 (line 12). All these settings affected the complete plot, whereas the following commands act on data set 1, which is given as the first parameter to all commands in lines 14-19. First the line colour is set to black (line 14). The first six colours are coded as the 6 default pen colours on a HP plotter, i.e. red, green, blue, purple, yellow and black. $\star$]$\star$Those default colours can be redefined using the command 'color'. In the following lines, the line width, marker type, marker colour and marker size are defined (lines 16-18). The different marker types supported by KUPLOT are shown in Figure 2.3. Error bars in y-direction based on the $\sigma_{y}$ values read from the input file 'test.xy' are enabled in line 19. The caption "Test data" is defined in line 21 and the annotation "Annotation" at the coordinates (2.0,12.0) is specified by the 'sann' command in line 22. Note, the value 1 in line 30 stands for the first annotation and not for data set one. Finally the plot is displayed on the screen (line 23).


  
Figure 2.3: KUPLOT marker types
\includegraphics[scale=0.6]{pl1.3.eps}


  
Figure 2.4: KUPLOT plotting styles
\includegraphics[scale=0.6]{pl1.4.eps}

In this example, the data points (xi,yi) were simply connected by a straight line. KUPLOT offers two alternative plotting styles: a histogram style and cubic spline interpolation. The style is selected by the 'lart' command followed by the data set number and the desired style. Style '1' is the default and connects the data points by a straight line as in the previous example ('lart 1,1'). This style is shown in Figure 2.4 in the bottom view graph. The histogram style '2' is shown in the middle view graph of the same Figure. Here each data point (xi,yi) sits in the center of a histogram step. The command to change the plotting style of data set 1 to histogram would be 'lart 1,2'. The third mode ('lart 1,3' for data set 1) is cubic spline interpolation. The interpolated spline goes through all data points (xi,yi) and has a continuous first derivative. The spline interpolation of the data set 'test.xy' can be seen as top view graph in Figure 2.4. The default number of interpolated points for a plot is 500. However, the value, determined by the variable MAXSP might be altered in the file 'kuplot.inc' before KUPLOT is compiled.


next up previous contents
Next: 2.3 Fonts and special Up: 2. Plotting 1D data Previous: 2.1 File formats
Thomas Proffen {Billinge}
1999-06-26