Next: , Previous: every, Up: data


3.15.3.2 example datafile

This example plots the data in the file "population.dat" and a theoretical curve:

           pop(x) = 103*exp((1965-x)/10)
           set xrange [1960:1990]
           plot 'population.dat', pop(x)
     

The file "population.dat" might contain:

           # Gnu population in Antarctica since 1965
              1965   103
              1970   55
              1975   34
              1980   24
              1985   10
     

Binary examples:

           # Selects two float values (second one implicit) with a float value
           # discarded between them for an indefinite length of 1D data.
           plot '<file_name>' binary format="%float%*float" using 1:2 with lines
     
           # The data file header contains all details necessary for creating
           # coordinates from an EDF file.
           plot '<file_name>' binary filetype=edf with image
           plot '<file_name>.edf' binary filetype=auto with image
     
           # Selects three unsigned characters for components of a raw RGB image
           # and flips the y-dimension so that typical image orientation (start
           # at top left corner) translates to the Cartesian plane.  Pixel
           # spacing is given and there are two images in the file.  One of them
           # is translated via origin.
           plot '<file_name>' binary array=(512,1024):(1024,512) format='%uchar' \
                dx=2:1 dy=1:2 origin=(0,0):(1024,1024) flipy u 1:2:3 w rgbimage
     
           # Four separate records in which the coordinates are part of the
           # data file.  The file was created with a endianess different from
           # the system on which gnuplot is running.
           splot '<file_name>' binary record=30:30:29:26 endian=swap u 1:2:3
     
           # Same input file, but this time we skip the 1st and 3rd records
           splot '<file_name>' binary record=30:26 skip=360:348 endian=swap u 1:2:3
     

See also matrix.