Example using the epslatex terminal in Gnuplot (equation in plot)

Here’s a short example of how to generate a high-quality vector image using the epslatex terminal in Gnuplot. The png version is shown here for comparison, but the pdf version is available here (note that you can zoom in as far as you like without any pixelation): ocpvp-crop


This plot used a data set:
# h2ox1 Ph2(psig), Eagagcl
-0.00098 -0.16
0.5659 -0.225
0.71943 -0.231
0.74305 -0.238
1.1564 -0.258
2.50274 -0.254
4.03804 -0.258
4.74664 -0.261

and the gnuplot script looks like this:

set key off
set terminal epslatex size 5,3
set output 'h2ox1_ocpvp.tex'
set xrange [-0.1:5]
set xlabel "$ P_{\\mathrm{H}_2}/ \\mathrm{psi_g}$"
set ylabel "$E/\\mathrm{mV}_{\\mathrm{SHE}}$"
set label "$E = \\frac{RT}{nF} \\ln(\\frac{[\\mathrm{H}^+]^2}{P_{\\mathrm{H}_2}}) $" at 1,0
set arrow from 1.5,-15 to 1.5, -35
plot 'ocpvp.dat' u 1:($2+0.21)*1000 pt 7 ps 1.25, 0.0128*log(0.004/(x/14.7))*1000 lw 4

After writing the script, all one needs to do is load the file from within gnuplot:

load 'myplotscript.plt'

and that will generate the required image in a .tex format. Then one simple has to call that file using the \include statement in a latex file like this:


This will generate the desired pdf image.

Gnuplot example

This is a simple example that shows a nice encapulated post script (.eps) plot made with only 9 lines of gnuplot commands.

another gnuplot example

here’s the gnuplot code:

set xlabel “{/Symbol n}^{1/2}”
set ylabel “{/Symbol D}E_p (V)”
set key center right
set label 1 “{/Symbol D}E_p({/Symbol n}^{1/2}) = 0.055 + 0.0035 {/Symbol n}^{1/2}” at 7,0.11
set label 2 “{/Symbol D}E_p({/Symbol n}^{1/2}) = 0.079 + 0.012 {/Symbol n}^{1/2} ” at 7,0.23
plot “data_1″ title “GC” w lines lw 5, “data_2″ title “Pt” w lines lw 5
set terminal postscript eps color enhanced “Helvetica” 16
set output ‘myplot.eps’

The data is stored in two text files called data_1 and data_2, and gnuplot produces an encapsulated postscript image
called myplot.eps.

The data files look like this:
3.16         0.11
5               0.147
7.07        0.169
10              0.2
14.14        0.25

3.16         0.063
5              0.075
7.07         0.081
10            0.092
14.14       0.103

The program is used by navigating to the directory that has the plotter and data files, then running the command:

$ gnuplot
gnuplot> load ‘plotter’

the eps image appears in the directory

Creating gif animations in Gnuplot 4.6

This is one approach to using Gnuplot 4.6 to create a gif animation from a separate text file
that has one time column and eight data columns. The Gnuplot text file could look like this:

# Gnuplot seven-channel time series animation generator (gif)
# gnuplotscript.txt
# 12/2012
# Assumes a data text file (myfile.dat) with eight columns of data, the first being the time, and the other seven being normalized data
# The data (text) file is assumbed to be named myfile.dat
# The data file must have all preamble infomration deleted so the first row in the file myfile.dat is time series data, not text
unset key
unset ytics
unset xtics
set style data lines
set yrange[-1:11]
set terminal gif size 1000,800 animate delay 2
set output “myanimation.gif”
do for [t=1:1500]{
set xrange[((t/100.)-1):((t/100.)+1)]
plot “myfile.dat” using 1:2 lw 2, “myfile.dat” using 1:3 lw 2, “myfile.dat” using 1:4 lw 2, “myfile.dat” using 1:5 lw 2, “myfile.dat” using 1:6 lw 2, “myfile.dat” using 1:7 lw 2, “myfile.dat” using 1:8 lw 2}

and this file is run by entering the following command in the command line (after using cd to change to the correct directory):

gnuplot gnuplotscript.txt

which will create the file called myanimation.gif in the same directory

Animating data in Mathematica

In Mathematica, large sets of data can easily be animated using a few lines of code. One approach is shown below:

rawdata =

animationtable =
Transpose[{rawdata[[All, 1]][[10000 ;; 130000]],
rawdata[[All, i]][[10000 ;; 130000]]] + (22 i)}], {i, 2,
7}], Frame -> True, Axes -> False, AxesLabel -> False,
FrameTicks -> None,
PlotRange -> {{(j – 2.5), (j + 2.5)}, {20, 165}},
ImageSize -> 750, PlotStyle -> Thick], {j, 3.5, 9.5, 0.08}];

animationtable, “DisplayDurations” -> 0.15]

Six channels of nerve signals

A similar example for animating cyclic voltammetric data:

hydrogen adsorption/desorption

Installing Linux Mint on a Mac Pro

The basic procedure was as follows:

(1) Use bootcamp to create a partition (just create the partition and then quit bootcamp; don’t let it do anything else)

(2) Insert the linux distro of your choice (download the .iso file and use disk utility to burn it to a dvd) in the dvd drive

(3) Restart the computer while hold the alt key

(4) Choose “Windows” and follow the instructions to install the linux system (the Mac will always identify it as Windows and never Linux)

(5) configure a special file so linux can use the sound card as follows:

$ cd /etc/modprobe.d/

$ sudo gedit alsa-base.conf

when gedit opens the file, write this at the bottom of the file:

options snd-hda-intel model=imac24

(yes, I know you have a mac pro and not an imac, but that’s the expression that will work)

then re-start the computer. I’m running 64-bit Linux Mint now with sound working and two monitors displaying everything well. The only part of the system that isn’t streamlined is that I have to use the “alt startup” everytime I want to boot into linux, whereas I expected it to automatically give me the option. Not too big of a deal. More to come later on the comparisons between Mint and OS X.

4/29/12 Update- after some further tweaks (removing all partitions), my Mac Pro is unable to install OS X, but runs Linux Mint 12 just fine… now a pure Linux Mint machine, which boots directly into Mint without refit, bootcamp, VMware, or anything like that.