User1291
User1291

Reputation: 8229

gnuplot - USING string variables

I'm trying something very simple ...

#!/usr/bin/gnuplot
reset

filename = "something_or_other"

set terminal pngcairo dashed size 800,400 enhanced font 'Verdana,10'
set output filename.".png"
set title filename."\n"
set xlabel "probably time"
set ylabel "probably something else" offset graph 0.2,0.6 rotate by 0

plot filename.".dat" using 1:2 lc rgb "#00E80000" title "measurements"

!display filename.".png"

except filename stays just like that and doesn't get interpreted as a string.

How do I get this working?

Upvotes: 2

Views: 2763

Answers (1)

Christoph
Christoph

Reputation: 48440

The exlamation mark ! at the beginning of the line makes gnuplot send this whole line as it is to a shell. So, here you cannot use any gnuplot variables and string concatenation. For this you can use system():

system(sprintf("display %s.png", filename))

Upvotes: 2

Related Questions