filename variables in gnuplot

I was trying to teach my bloody windows workspace to update the plotfile not only in the data-directory where Data and plotfiles are located, but also leave one version in my latex-document directory. I learned, that you can even use variables for filenames used by gnuplot. And apart from commands issued via !command it is absolutely flexible concerning slashes or backslashes.

xplotsize = 1
yplotsize = 1.3
datadir     = './Data/Measurement1'
graphicsdir = './Plots'
filename = 'plot-400w'

set datafile separator ','
set decimalsign ','

set terminal png size (xplotsize*500),(yplotsize*500)
set output datadir.'/'.filename.'.png'

plot datadir.'/Sample_Int_20.dat' \
     u 1:3 w l ti  '$\phi_{\phi^2}=\unit{1,76e-7}{mbar}$', \
     cos(x) w lp ti 'Cosine'

# replot to Graphics directory
set size xplotsize,yplotsize
set terminal epslatex color solid
set output graphicsdir.'/'.filename.'.tex'

# preview
set size 1,1; set term wxt size (xplotsize*500),(yplotsize*500); replot;

# get pdf in your graphicsdir, remove eps (windows-version)
cd graphicsdir
!epstopdf plot.eps & del plot.eps

With this setup you would have to change the second file-extension specified in the updateplot-command to png. This would be then your indicator-file.


Peter Pan. Kann fliegen mit Feenstaub.

Tagged with: , ,
Posted in LaTeX, Technik, Wissen und Wissenschaft

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Posts by topic…
…by month
Have a look at…

%d bloggers like this: