Gnuplot 打印数据文件。make:results2.data:command可插入

Gnuplot 打印数据文件。make:results2.data:command可插入,gnuplot,Gnuplot,我被gnuplot实验卡住了。我是gnuplot的新手,正在尝试探索gnuplot的选项和多样性 首先,我想做的是:从一个c程序中,我想绘制5个数据文件。尽管如此,我还是使用了一个.gplt文件、一个makefile和一个.c文件与lubuntu上的geany一起工作 以下是文件的外观: ===============================simulation.gplt==================== plot 'result1.data' using 2:3 title "F

我被gnuplot实验卡住了。我是gnuplot的新手,正在尝试探索gnuplot的选项和多样性

首先,我想做的是:从一个c程序中,我想绘制5个数据文件。尽管如此,我还是使用了一个.gplt文件、一个makefile和一个.c文件与lubuntu上的geany一起工作

以下是文件的外观:

===============================simulation.gplt====================

plot 'result1.data' using 2:3 title "F" w lines
plot 'result2.data' using 2:3 title "F" w lines
plot 'result3.data' using 2:3 title "F" w lines
plot 'result4.data' using 2:3 title "F" w lines
plot 'result5.data' using 2:3 title "F" w lines

set ouput "simulation.ps"
replot
======================================================================在此处输入代码

all:run plot

plot: result1.data
      result2.data
      result3.data
      result4.data 
      result5.data
    gnuplot simulation.gplt
    ps2pdf simulation.ps
    rm -f simulation.ps
    evince simulation.pdf

run:program
    ./program

program: program.c
    gcc -Wall -o program -O3 program.c -lm -g

clean:
      rm -f program
      rm -f result1.data
      rm -f result2.data
      rm -f result3.data
      rm -f result4.data
      rm -f result5.data
      rm -f simulation.pdf
      rm -f simulation.ps

我能在终端机上输入什么使它干净,一切看起来都很好。然而,当我键入make时,我看到以下两条消息:

make:result2.data:未知命令 生成****[plot]错误127


问题是:有人能帮忙吗?我觉得Makefile中的错误,我多次尝试修复它,但仍然出现相同的消息

首先,我编辑了您的问题,并在每行代码的开头添加了四个空格。这样,您可以获得一个很好的格式

现在,我在make文件和gnuplot代码中看到了几个问题:

gnuplot 您的代码在屏幕上生成四个绘图,每个绘图都覆盖最后一个绘图。然后,打开一个文件并执行replot。此命令重复上一个plot命令,即只有result5.data将写入文件。 其次,仅仅设置输出文件是不够的。必须首先指定终端文件类型

这将生成一个5页的PS文件,每页一个绘图:

set terminal postscript
set output "simulation.ps"
plot 'result1.data' using 2:3 title "F" w lines
plot 'result2.data' using 2:3 title "F" w lines
plot 'result3.data' using 2:3 title "F" w lines
plot 'result4.data' using 2:3 title "F" w lines
plot 'result5.data' using 2:3 title "F" w lines
unset output
或者,如果希望所有数据都包含在一个图表中,请使用以下命令:

set terminal postscript
set output "simulation.ps"
plot 'result1.data' using 2:3 title "F" w lines,\
     'result2.data' using 2:3 title "F" w lines,\
     'result3.data' using 2:3 title "F" w lines,\
     'result4.data' using 2:3 title "F" w lines,\
     'result5.data' using 2:3 title "F" w lines
unset output
注意:五个打印对象用逗号分隔。反斜杠\允许在下一行中继续,因此,实际上只有一行具有大型绘图命令

但是,不需要使用gnuplot生成postscript文件,然后将其转换为PDF。gnuplot可以直接生成PDF:

set terminal pdfcairo mono dashed size 8in, 11in
set output "foo.pdf"
plot sin(x), cos(x)
unset output
在这里,我添加了一些选项来生成一个DIN A4纸张大小的绘图,用黑/白代替彩色,并带有虚线。有很多选项,请在gnuplot中通过帮助pdfcairo进行检查

生成文件 先决条件列表必须在一行中给出。但与gnuplot一样,您可以使用\跨多行:

plot: result1.data \
      result2.data \
      result3.data \
      result4.data \
      result5.data
    gnuplot simulation.gplt
    ps2pdf simulation.ps
    rm -f simulation.ps
    evince simulation.pdf    
这正是错误消息告诉您的:它想要处理规则图。results1.data已经存在,然后它尝试运行第二行中的命令,即results2.data。因为这不是一个命令,所以您会得到错误


另一个问题是make确实需要在每个命令行前面有一个制表器,而不仅仅是空格。确保你的编辑器插入标签,很多人喜欢插入四个空格!此处无法检查此错误,因为此处看不到选项卡。

我想模拟到达超市的客户的哭泣和回答时间。整个程序是用c语言编程的。