gnuplot的参数 (new)

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

gnuplot的参数 (new)

#1

帖子 eexpress » 2008-04-27 20:46

有个问题,如果这样调用一脚本的方式。
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。
上次由 eexpress 在 2008-05-13 10:52,总共编辑 1 次。
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#2

帖子 eexpress » 2008-04-28 21:50

第2个似乎没问题,没有的数据,缺省是0。只是不能使用“相对”宽度,而是要使用“绝对”宽度来画图。
类似这样
set boxwidth 0.7 absolute


第3个问题了。
想设置一个最高Y轴为500,大于500的,在边上标注出实际的数值。
X轴设置为31个最大数据,需要调整宽度。或者在X轴,纵向显示实际数值。
● 鸣学
头像
roylez
帖子: 1928
注册时间: 2005-10-04 10:59
来自: 上海

#3

帖子 roylez » 2008-05-01 9:52

现在在家,自己的电脑不在手边。代码可能写得不对,但是意思你应该能够明白。第三个问题应该也一样可以解决。
我比较喜欢用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))
aBiNg
帖子: 1331
注册时间: 2006-07-09 12:22
来自: 南京

#4

帖子 aBiNg » 2008-05-01 10:51

金主席,python调gnuplot还不如shell调之呢,传递变量,呵呵。

eexp想要gnuplot内置var.变量的调用,似乎不太可能。
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#5

帖子 eexpress » 2008-05-02 8:58

嗯拉。我要调用那dem的时候,带入参数。要是一行一行的送命令,等于是建立临时的dem文件了。

看来,先解决第3个吧。如图。差距太大。限制xy坐标最好。
附件
screenshot-2008-05-02-09-09-58.png
screenshot-2008-05-02-09-09-58.png (8.41 KiB) 查看 3351 次
● 鸣学
头像
roylez
帖子: 1928
注册时间: 2005-10-04 10:59
来自: 上海

#6

帖子 roylez » 2008-05-02 12:48

set yrange[:500]

然后用python对数据进行过滤,y>500的地方,加个label不就行了?确实是相当于建立了临时的dem文件,不过方便过写dem文件,毕竟可以在python里面就先对数据进行处理。

我记得gnuplot也可以用变量的。你查查。
http://t16web.lanl.gov/Kawano/gnuplot/index-e.html
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#7

帖子 eexpress » 2008-05-02 19:04

这地址不错。一直没精心去看,现在终于有想法,慢慢看下了。呵呵。多谢啊。
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#8

帖子 eexpress » 2008-05-02 20:07

看了一部分。其实就这样。临时就临时吧。
附件
screenshot-2008-05-02-20-05-53.png
screenshot-2008-05-02-20-05-53.png (9.07 KiB) 查看 5640 次
screenshot-2008-05-02-20-05-34.png
● 鸣学
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#9

帖子 eexpress » 2008-05-13 10:51

代码: 全选

☎  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表示电平。

另外想,这方波的线,加粗,加蓝色的。
附件
需要产生的样式
需要产生的样式
screenshot-2008-05-13-11-33-45.png (3.5 KiB) 查看 3343 次
● 鸣学
头像
Tenyears
帖子: 2245
注册时间: 2005-06-30 15:46
来自: 成都

#10

帖子 Tenyears » 2008-05-15 10:03

ee,我来了,不过是进来学习的

让你失望了
Humanity to others // 己所不欲,勿施与人
Laptop: ThinkPad X220 --- Win7 Home / Ubuntu 12.04
Desktop: Win7/Ubuntu 12.04
Server: Ubuntu12.04
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

#11

帖子 eexpress » 2008-05-15 10:41

啊。赶紧学啊。我都没人问的啊。
金,估计去忙找工作去了。
就剩下你有希望了啊。
● 鸣学
头像
pollothana
帖子: 262
注册时间: 2007-03-08 10:47

Re: gnuplot的参数 (new)

#12

帖子 pollothana » 2012-06-20 15:58

我来挖个坟,很久没上论坛了,今天正好看到这个问题。
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 可以,其他版本没注意。
My blog: hsquared66.blogspot.com
头像
pollothana
帖子: 262
注册时间: 2007-03-08 10:47

Re: gnuplot的参数 (new)

#13

帖子 pollothana » 2012-06-20 16:13

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
My blog: hsquared66.blogspot.com
回复