Gnuplot spitting junk to CL, saying file not found

Hi,
I am making a shell script in bash which uses gnuplot to plot the number of road accidents on a certain day, on a certain month. I believe I have the data correct. An example of my data file is here:

cat Day1Accidents.txt
01 13
02 5
03 17
04 8
05 16
06 18
07 12
08 7
09 23
10 12
11 7
12 19

(So the left column [x axis] is the month, and the second [y] is the number of accidents, and the whole data set is for "monday")
But I cant seem to get gnuplot to make me an image, I tried putting in a <gpi> script, I got a simple graph(not what i wanted though) but then it didnt seem to want to plot, and there are problems with importing file name etc
Currently the code spits loads of unusual character to the command line, and then says the file is not found....
Here is my gnuplot code, if anyone can point me in the right direction I would be very grateful :slight_smile:

gnuplot << EOF
set output "accidents_"$Postocode.png"
set terminal png
set size 1280,800
set data style linespoints
set title "Number of accidents within a radius of $2 from $Postcode"
set xlabel "Month"
set ylabel "Number of Accidents"
set xtics 1,1,12
set ytics 5,5,35
set key rmargin
plot "Day1Accidents.txt" using 1:2 title "Monday"
plot "Day2Accidents.txt" using 1:2 title "Tuesday"
plot "Day3Accidents.txt" using 1:2 title "Wednesday"
plot "Day4Accidents.txt" using 1:2 title "Thursday"
plot "Day5Accidents.txt" using 1:2 title "Friday"
plot "Day6Accidents.txt" using 1:2 title "Saturday"
plot "Day7Accidents.txt" using 1:2 title "Sunday"
EOF

Thanks

A quote too many in

set output "accidents_"$Postocode.png"
1 Like

Damn, I knew it would be something simple.:b:
Thank-you.
Just in case anyone else reads this, I also messed around with the order of the things I am setting.
Changing them to this order worked:

 Set terminal <type> size <x> <y>
 Set output "outputname"
 Set data style <type>

everything else the same order :slight_smile: