Pretty Plots with Gnuplot
Given a data file that looks something like this:
//   f(GHz)       S211(dB)     S212(dB)     S213(dB)     S214(dB)     S215(dB)     S216(dB)     S217(dB)
   0.100E+00   -0.743E-03    0.586E-03   -0.390E-02   -0.787E-02   -0.930E-02   -0.159E-01   -0.164E-01
   0.200E+00   -0.354E-02   -0.616E-02   -0.161E-01   -0.270E-01   -0.374E-01   -0.537E-01   -0.673E-01
   0.300E+00   -0.820E-02   -0.174E-01   -0.364E-01   -0.589E-01   -0.843E-01   -0.117E+00   -0.152E+00
   0.400E+00   -0.147E-01   -0.331E-01   -0.649E-01   -0.104E+00   -0.150E+00   -0.206E+00   -0.272E+00

We want to make a plot. The X-axis of the plot is column 1 and the Y-axes are all the other columns. The software we're going to use is gnuplot.

Step 1
In gnuplot, comments are designated with the # sign. Edit the data file so that any comment lines looks like this:

#   f(GHz)       W345(dB)     W346(dB)     W347(dB)     W348(dB)     W349(dB)     W350(dB)     W351(dB)

Step 2
Make an input file (I called this file tf.gp) with instructions for how to make the plot. Below is the file that I used.

# Plot of file.dat 

# This command works for a linux computer. In linux, you need to specify the exact location of
# the font you want to use
set terminal png notransparent rounded giant font "/usr/share/fonts/msttcore/arial.ttf" 24 \
  size 1200,960 

# nomirror means do not put tics on the opposite side of the plot
set xtics nomirror
set ytics nomirror

# On the Y axis put a major tick every 5
set ytics 5

# On both the x and y axes split each space in half and put a minor tic there
set mxtics 2
set mytics 2


# Line style for axes
# Define a line style (we're calling it 80) and set 
# lt = linetype to 0 (dashed line)
# lc = linecolor to a gray defined by that number
set style line 80 lt 0 lc rgb "#808080"

# Set the border using the linestyle 80 that we defined
# 3 = 1 + 2 (1 = plot the bottom line and 2 = plot the left line)
# back means the border should be behind anything else drawn
set border 3 back ls 80 

# Line style for grid
# Define a new linestyle (81)
# linetype = 0 (dashed line)
# linecolor = gray
# lw = lineweight, make it half as wide as the axes lines
set style line 81 lt 0 lc rgb "#808080" lw 0.5

# Draw the grid lines for both the major and minor tics
set grid xtics
set grid ytics
set grid mxtics
set grid mytics

# Put the grid behind anything drawn and use the linestyle 81
set grid back ls 81

# Add line at -3db
# Draw a line from the right end of the graph to the left end of the graph at
# the y value of -3
# The line should not have an arrowhead
# Linewidth = 2
# Linecolor = black
# It should be in front of anything else drawn
set arrow from graph 0,first -3 to graph 1, first -3 nohead lw 2 lc rgb "#000000" front

# Put a label -3db at 80% the width of the graph and y = -2 (it will be just above the line drawn)
set label "-3dB" at graph 0.8, first -2

# Create some linestyles for our data
# pt = point type (triangles, circles, squares, etc.)
# ps = point size
set style line 1 lt 1 lc rgb "#A00000" lw 2 pt 7 ps 1.5
set style line 2 lt 1 lc rgb "#00A000" lw 2 pt 11 ps 1.5
set style line 3 lt 1 lc rgb "#5060D0" lw 2 pt 9 ps 1.5
set style line 4 lt 1 lc rgb "#0000A0" lw 2 pt 8 ps 1.5
set style line 5 lt 1 lc rgb "#D0D000" lw 2 pt 13 ps 1.5
set style line 6 lt 1 lc rgb "#00D0D0" lw 2 pt 12 ps 1.5
set style line 7 lt 1 lc rgb "#B200B2" lw 2 pt 5 ps 1.5

# Name our output file
set output "tf.png"

# Put X and Y labels
set xlabel "Frequency, GHz"
set ylabel "Transmission, dB"

# Set the range of our x and y axes
set xrange [1:10]
set yrange [-30:5]

# Give the plot a title
set title "Transmission vs Frequency"

# Put the legend at the bottom left of the plot
set key left bottom

# Plot the actual data
# u 1:2 = using column 1 for X axis and column 2 for Y axis
# w lp = with linepoints, meaning put a point symbol and draw a line
# ls 1 = use our defined linestyle 1
# t "Test 1" = title "Test 1" will go in the legend
# The rest of the lines plot columns 3, 5 and 7
plot "file.dat" u 1:2 w lp ls 1 t "Test 1", \
"file.dat" u 1:4 w lp ls 3 t "Test 2", \
"file.dat" u 1:6 w lp ls 5 t "Test 3", \
"file.dat" u 1:8 w lp ls 7 t "Test 4"

# This is important because it closes our output file.
set output 

Step 3
Start gnuplot and run your file.

$ gnuplot

	G N U P L O T
	Version 4.2 patchlevel 6 
	last modified Sep 2009
	System: Linux 2.6.32-431.17.1.el6.x86_64

	Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009
	Thomas Williams, Colin Kelley and many others

	Type `help` to access the on-line reference manual.
	The gnuplot FAQ is available from http://www.gnuplot.info/faq/

	Send bug reports and suggestions to 


Terminal type set to 'x11'
gnuplot> load 'tf.gp'
gnuplot> quit

Step 4
The file tf.png should have been created. Open it and take a look.

output plot


Notes
To find out which numbers refer to which line types, thicknesses, etc. Run the test command in gnuplot.

$ gnuplot

	G N U P L O T
	Version 4.2 patchlevel 6 
	last modified Sep 2009
	System: Linux 2.6.32-431.17.1.el6.x86_64

	Copyright (C) 1986 - 1993, 1998, 2004, 2007 - 2009
	Thomas Williams, Colin Kelley and many others

	Type `help` to access the on-line reference manual.
	The gnuplot FAQ is available from http://www.gnuplot.info/faq/

	Send bug reports and suggestions to 


Terminal type set to 'x11'
gnuplot> set terminal png
Terminal type set to 'png'
Could not find/open font when opening font "arial", using internal non-scalable font
Options are 'nocrop medium '
gnuplot> set output 'test.png'
gnuplot> test
gnuplot> set output
gnuplot> quit
Here is what the image looks like. test file

On linux, it's probably good to install the Microsoft fonts. I downloaded them here.

Updated: June 2014