我在 ubuntu 12.10 下使用 gnuplot。当我输入终端时:
gnuplot> plot sin(x)
Run Code Online (Sandbox Code Playgroud)
它只显示下一步:
gnuplot>
Run Code Online (Sandbox Code Playgroud)
但它不显示图形绘制窗口。我该怎么做才能找到问题?
我想要做的是编写一个脚本,它首先启动一个程序,然后告诉它执行一堆命令,然后退出。让我们举一个例子。
我写了这个脚本myscript.sh,但它没有按照我想要的方式工作。它所做的只是运行 gnuplot 并等待它退出,然后运行其他命令;这显然会产生错误。
#!/bin/bash
gnuplot
plot sin(x)
pause -1
quit
Run Code Online (Sandbox Code Playgroud)
我想我想做什么很清楚;如果没有,请在评论中告诉我。
我是 gnuplot 的新手,我在传递我的论点时遇到了很多麻烦,现在我有了这个简单的 bash 脚本和一个 gnuplot 脚本。
在 bash 脚本中,plot.sh我应该修改我的文件,然后将其发送到要绘制的 gnuplot 脚本,或者我可以修改我的文件,然后将一个参数(从另一个脚本 $1 传递的数字)发送到 gnuplot 脚本,该脚本标识要绘制的文件,问题是这两种方式都不起作用,我似乎没弄对!有什么帮助吗?
这是我的 bash 脚本 plot.sh
#!/bin/bash
sed -i 's/ns/;/g' /dev/shm/waitingTime$1.txt
gnuplot -e "filename='/dev/shm/waitingTime$1'" file.gnuplot
Run Code Online (Sandbox Code Playgroud)
这是我的名为 file.gnuplot 的 gnuplot 脚本
#!/home/yas/file.gnuplot
set xlabel "start"
set ylabel "Delay"
set autoscale
set style line 1 lt 1 lw 3 pt 3 linecolor rgb "red"
plot<"filename"> using 1:2 w points title "tests"
set terminal postscript portrait enhanced mono dashed lw 1 'Helvetica' 14
set output '/dev/shm/TT.pdf'
pause …Run Code Online (Sandbox Code Playgroud) 在GnuPlot 中,我将xtics设置为这样的:
设置 xtics
("AIM" 0.00000, "gtalk" 2.00000, "rtp-multicast-filetransfer" 4.00000, "sipc_music" 6.00000, "skype1" 8.00000, "skype2" 10.00000, "00100000000000000000000000000000000000000000000000000000000000000000000 , "信息使者" 16.00000)
问题是,这些标签在图中彼此重叠,那么我如何消除/克服这种重叠?
我可以增加xticks之间的长度或写一些图例显示:
rmf : rtp-multicast-filetransfer?
我想为一个文件编写 gnuplot 命令,该文件只有一列。在文件中,该列是 Y,但在文件中我没有 X 的列。 X 的列元素是
1
2
3
4
5
6
7
Run Code Online (Sandbox Code Playgroud)
.注意下面的人认为他们是我的档案女巫他们“
12
43
65
76
12
56
Run Code Online (Sandbox Code Playgroud)
" 正如你所看到的,我有 Y 的元素,但我的文件中没有 X 的元素,我的意思是 X elemat 基于行号。我想 gnuplot 中应该有一个命令可以做到这一点。