0

code:

#!/usr/bin/env bash
# download death data
wget -O Deaths.txt http://www.randomservices.org/random/data/Deaths.txt
wget -O Pumps.txt http://www.randomservices.org/random/data/Pumps.txt
# Delete the first line
sed 1d Deaths.txt > tempfile1
sed 1d Pumps.txt > tempfile2
# mv tempfile1 Deaths.txt
# mv tempfile2 Pumps.txt
gnuplot -persist -e "set terminal canvas;set xlabel 'x' font 'sans,15';
set ylabel 'y' font ',15';
set title 'Relationship between Deaths and Pumps' font 'sans, 20';
show title;
set label "Most of the deaths is near the pump located in 12.6,11.7" at 16,16;
show label;
set output 'death_pump_relation.html';
plot 'Pumps.txt' with points pt 7 ,'Deaths.txt' with dots;"

There is a error: line 0: unexpected or unrecognized token

and I cannot get any output

But in fact, there is no line0 in my script

What is wrong with that?

Version : gnuplot V5.2

System: MacOS

2

here is the working script

#!/usr/bin/env bash
# download death data
wget -O Deaths.txt http://www.randomservices.org/random/data/Deaths.txt
wget -O Pumps.txt http://www.randomservices.org/random/data/Pumps.txt
# Delete the first line
sed 1d Deaths.txt > tempfile1
sed 1d Pumps.txt > tempfile2
mv tempfile1 Deaths.txt
mv tempfile2 Pumps.txt
gnuplot -persist -e "set terminal canvas;set xlabel 'x' font 'sans,15';
set ylabel 'y' font ',15';
set title 'Relationship between Deaths and Pumps' font 'sans, 20';
show title;
set label 'Most of the deaths is near the pump located in 12.6,11.7' at 16,16;
show label;
set output 'death_pump_relation.html';
plot 'Pumps.txt' with points pt 7 ,'Deaths.txt' with dots;"

output is in death_pump_relation.html

  • the " should be there because it shoule match the " after gnuplot -persist -e – Yiling Liu May 13 at 3:55
  • 1
    You are correct. The issue is set label "Most of the deaths is near the pump located in 12.6,11.7" at 16,16; change the " to ' – al76 May 13 at 4:19
  • @al76 for the benefit of future readers, it would be helpful imho if you included that information (i.e. that the issue is the attempt to "nest" quoted strings) in your answer – steeldriver May 13 at 16:24
1

I know what is wrong there

# mv tempfile1 Deaths.txt
# mv tempfile2 Pumps.txt

shoule not be commeted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.