分页: 1 / 1
gnuplot的参数 (new)
发表于 : 2008-04-27 20:46
由 eexpress
有个问题,如果这样调用一脚本的方式。
gnuplot plot.dem 2008
可以把这参数2的那2008带入plot.dem里面作一个变量不。就是要用这参数,来改变图片输出的标题和文件名。
类似这样的
set output "gnuplot-$1.png"
set title "easy-account chart $1"
第2个问题
plot 'chart.dat' using 1:2 with boxes
如果这dat文件缺少了数据,如何设置缺少的数据为0
比如:
01 3.00
03 2.00
04 164.40
少了02的数据。想画02这坐标时,缺省为0。
发表于 : 2008-04-28 21:50
由 eexpress
第2个似乎没问题,没有的数据,缺省是0。只是不能使用“相对”宽度,而是要使用“绝对”宽度来画图。
类似这样
set boxwidth 0.7 absolute
第3个问题了。
想设置一个最高Y轴为500,大于500的,在边上标注出实际的数值。
X轴设置为31个最大数据,需要调整宽度。或者在X轴,纵向显示实际数值。
发表于 : 2008-05-01 9:52
由 roylez
现在在家,自己的电脑不在手边。代码可能写得不对,但是意思你应该能够明白。第三个问题应该也一样可以解决。
我比较喜欢用python-gnuplot来调用gnuplot。
代码: 全选
import Gnuplot
title = sys.argv[1]
g = Gnuplot.gnuplot(persist=1)
g('set output "gnuplot-%s.png" ' %title)
g('set title "easy-account chart %s" ' %title)
或者
代码: 全选
g('''
set output "gnuplot-%s.png"
set title "easy-account chart %s"
''' %(title, title))
发表于 : 2008-05-01 10:51
由 aBiNg
金主席,python调gnuplot还不如shell调之呢,传递变量,呵呵。
eexp想要gnuplot内置var.变量的调用,似乎不太可能。
发表于 : 2008-05-02 8:58
由 eexpress
嗯拉。我要调用那dem的时候,带入参数。要是一行一行的送命令,等于是建立临时的dem文件了。
看来,先解决第3个吧。如图。差距太大。限制xy坐标最好。
发表于 : 2008-05-02 12:48
由 roylez
set yrange[:500]
然后用python对数据进行过滤,y>500的地方,加个label不就行了?确实是相当于建立了临时的dem文件,不过方便过写dem文件,毕竟可以在python里面就先对数据进行处理。
我记得gnuplot也可以用变量的。你查查。
http://t16web.lanl.gov/Kawano/gnuplot/index-e.html
发表于 : 2008-05-02 19:04
由 eexpress
这地址不错。一直没精心去看,现在终于有想法,慢慢看下了。呵呵。多谢啊。
发表于 : 2008-05-02 20:07
由 eexpress
看了一部分。其实就这样。临时就临时吧。
发表于 : 2008-05-13 10:51
由 eexpress
代码: 全选
☎ cat irda.dat
1,0
9,1
4.5,0
# 0
0.56,1
0.56,0
# 1
0.56,1
1.69,0
# 0
0.56,1
0.56,0
# 0
0.56,1
0.56,0
# 1
0.56,1
1.69,0
# 1
0.56,1
1.69,0
# 0
0.56,1
0.56,0
# 1
0.56,1
1.69,0
新需求了。那X轴,需要使用宽度的数据,就是相对的宽度。反应到X轴,应该是增量坐标?
这是信号采集的数据,其实就是方波。一个宽度带一个0/1表示电平。
另外想,这方波的线,加粗,加蓝色的。
发表于 : 2008-05-15 10:03
由 Tenyears
ee,我来了,不过是进来学习的
让你失望了
发表于 : 2008-05-15 10:41
由 eexpress
啊。赶紧学啊。我都没人问的啊。
金,估计去忙找工作去了。
就剩下你有希望了啊。
Re: gnuplot的参数 (new)
发表于 : 2012-06-20 15:58
由 pollothana
我来挖个坟,很久没上论坛了,今天正好看到这个问题。
gnuplot -e "year='2008'" plot.dem
in file plot.dem:
代码: 全选
filename=sprintf("gnuplot-%s.png", year)
title=sprintf("easy-account chart %s", year)
set output filename
set title title
gnuplot 4.6 可以,其他版本没注意。
Re: gnuplot的参数 (new)
发表于 : 2012-06-20 16:13
由 pollothana
pollothana 写了:我来挖个坟,很久没上论坛了,今天正好看到这个问题。
gnuplot -e "year='2008'" plot.dem
in file plot.dem:
代码: 全选
filename=sprintf("gnuplot-%s.png", year)
title=sprintf("easy-account chart %s", year)
set output filename
set title title
gnuplot 4.6 可以,其他版本没注意。
或者也可以这么写:
代码: 全选
set output "gnuplot-".year.".png"
set title "easy-account chart ".year