GnuPlot

1 minute read

This page publishes GnuPlot tips (as they arise ;)

Example Plots

Histogram

Please be aware of the fact, that the first line in the data file is usually interpreted as column header and therefore not plotted.

set terminal postscript eps enhanced                                      # enhanced => adds support for LaTeX style labels
set xtics ('C5000' 0, 'C10000' 1, 'C50000' 2, 'C100000' 3, 'C500000' 4)   # labels on the x axis
set ylabel "P\@1"
set xlabel "gazetteer"

set style fill pattern 1 border lt -1                                     # histogram style
set datafile separator "\t"
set boxwidth 0.9 relative
set style data histograms

set arrow 10 from -1,70.8 to 5,70.8 nohead                                # horizontal line
set title "media use case: P^O\@1"                                        # diagram title
set output './media-histogram.ps'
plot [][0.000000:100.000000] './data01.csv' using 2 title "Amitay (small entities)", \
                             './data02.csv' using 2 title "Amitay (large entities)"
unset arrow

GnuPlot tips

Data Files

Plot datafiles with different separators:

  set datafile separator ","

Horizontal line

  set arrow 10 from -1,70.8 to 5,70.8 nohead

LaTeX Style equations

By choosing the enhanced terminal style gnuplot lets you use latex style equations in labels.

set terminal postscript eps enhanced      # option 1: add "enhanced" to the terminal specification
set termoption enhanced                   # option 2: manually set the "enhanced" option

# example labels
set title "media use case: P^O\@1"        
set xtics ('Al' 0, 'OC' 1, 'wL_{100k,a,+}' 2, 'wl_{500k,a,+}' 3, 'wl_{100k,a,-' 4)
  • Gnuplot Wiki - Example Screenshots + Code
  • Linux Foundation GnuPlot Tutorial

Categories:

Updated:

Leave a comment