blogger visitor

Techucation

A Blog by Malcolm Yoke Hean Low

 Subscribe in a reader




View Malcolm Low's profile on LinkedIn

Malcolm Low

Create Your Badge

 Subscribe in a reader


Enter your email address:

Delivered by FeedBurner

Quick Guide to GNUPlot - Example, Superscript, Subscript, Overbar, Underbar, Greek Symbols

Posted on Saturday, January 07, 2006 at 4:20 PM by Malcolm

Quick Guide to GNUPlot

Here is a quick guide to using GnuPlot to generate EPS output for including in LaTex file. Please note that most of the commands below only work with GnuPlot verions 3.7 and above.

See also

Setup

To plot a graph X , create two files, "plot.dat" and "plot.txt":

"data.txt" contains the columns of values to be plotted.
"plot.txt" contains the commands for gnuplot to plot the graph.
"plot.gif" contains the GIF output.

To generate the graph, run "gnuplot plot.txt".

Insert Superscript, Subscript and Greek Symbols

Insert "enhance postscript" in "plot.txt"

"set terminal postscript eps enhance 16"

Change 16 to whatever font size desired.

Superscript and Subscript

  • To have xyz as subscript of P, use "P_{xyz}"
  • To have xyz as superscript of P, use "P^{xyz}"
  • Note the use of open and close braces to group a set of characters
Overbar and Underbar
  • Although there isn't any postscript option to specify overbar and underbar, a way to simulate them is to do the following:
  • To have an overbar on the letter G, use "@^{\261}G" (short overbar) or "@^{\320}G" (long overbar)
  • To have an underbar on the letter G, use "@_{\261}G" (short underbar) or "@_{\320}G" (long underbar)
Greek Symbols
  • To have the symbol α (alpha), use "{/Symbol a}"
  • To have the symbol π (pi), use "{/Symbol p}"
  • To have the symbol λ (lambda), use "{/Symbol l}"
  • See the file below for a complete list of other available symbols
This PDF file from the installation directory list the postscript options and different symbols available in GnuPlot

Note that versions 3.5 or earlier do not support these postscript options

Placing Legend/Key at a specfic coordinate

  • To move the keys to coordinate say (3,4), use "set key 3, 4"

Change the size of the plot points

  • To change the size of the plot points to 2, use "set pointsize 2"

Set the size of the graph

  • To change the size of the plot to 5 by 5, use "set size 5,5"

Set xlabel/ylabel

  • To change the xlabel to "XLABEL", use " set xlabel "XLABEL" "
  • To change the ylabel to "YLABEL", use " set xlabel "YLABEL" "

Remove mirror tickmark

  • To remove mirror xtick marks, use "set xtics nomirror"
  • To remove mirror ytick marks, use "set ytics nomirror"

Set the range of X and Y axes

  • Example : "set xrange [0:50]"
  • Example : "set yrange [0:100]"

Preset Tickmark on X axis

  • To preset tickmark on x-axis, use "set xtics (10,100,1000,10000)"
  • Note that this can be combined with the option "nomirror" too.

Edited on: Sunday, May 27, 2012 12:24 PM

Posted in General (RSS)