Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot 5.0 'set output filename' in a gnuplot script does not work

Tags:

python

gnuplot

I am newbie to Gnuplot, and starting with gnuplot 5.0.0. Here is my problem: Consider very simple example of a gnuplot script named save.gpl:

set terminal dumb  
plot sin(x) with linespoints pointtype 5, cos(x) w boxes lt 4  
set term png   
set output “graph.png”   
replot  
set term dumb

When I try run this script from the shell terminal my mac (OX 10.0):
$ gnuplot save.gpl
it throw a error in line 4 (set output “graph.png”) saying:

"save.gpl", line 4: internal error : STRING operator applied to non-STRING type.

Same thing happens when I try to load my script from the gnuplot: gnuplot > load save.gpl

But if I execute each command in my script one at a time in the "gunplot >" mode, everything goes fine.

However, I need to use set output “filename.png" statements in a lot bigger script several times to save several plots. So, have to use this statement in the script.

Thanks in advance.

like image 756
JohnPaul Avatar asked Dec 06 '25 06:12

JohnPaul


1 Answers

You are using the wrong quotes. In your script you have the LEFT DOUBLE QUOTATION MARK (U+201C) and the RIGHT DOUBLE QUOTATION MARK (U+201D), which is wrong.

You must single ' (ASCII 0x27) or double quotes " (ASCII 0x22) as string delimiters, like you do in any scripting language.

set terminal pngcairo
set output "graph.png"
plot sin(x)
like image 86
Christoph Avatar answered Dec 08 '25 19:12

Christoph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!