各位:
当以直方图的形式表示数据时,我遇到了问题。我不知道如何清楚地表达我的意图,但我的想法是:
到目前为止,我已经完成了下面的工作,但这不允许我继续下去
我目前的代码是:
reset
fontSpec(s) = sprintf("Times-Roman, %d", s)
set term post eps enhanced fontSpec(16)
set output 'TVsG.eps'
set grid
set auto y
set auto x
ticsFont=fontSpec(16)
set xtics font ticsFont
set ytics font ticsFont
set ylabel "Temperature" font fontSpec(25) offset char -1,0
set xlabel "Group" font fontSpec(25) offset 0,char -1
set style fill pattern border -1
set style data histograms
set boxwidth 1.0
set style histogram clustered gap 1
keyFont=fontSpec(18)
set key spacing 2 font keyFont
set key at graph 0.25, 0.9
fn(v) = sprintf("%.1f", v)
plot \
for [COL=2:4] 'data.txt' using COL:xticlabels(1) title columnheader fs
pattern 2, \
'data.txt' u ($0-1-1./6):2:(fn($2)) w labels font fontSpec(14) offset
char 0,0.5 t '' , \
'data.txt' u ($0-1-1./6):2:(fn($3)) w labels font fontSpec(14) offset
char 0,0.5 t '' , \
'data.txt' u ($0-1+1./6):3:(fn($4)) w labels font fontSpec(14) offset
char 0,0.5 t ''我的数据文件
Material Hafnium Zirconium Titanium Tantalum
Carbide 3958 3400 3100 3768
Boride 3380 3245 3225 3040
Nitride 3385 2950 2950 2700 我现在遇到的主要问题是以下错误:
gnuplot> load 'gnuplot2.txt'
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: warning: Cannot find or open file "data"
"gnuplot2.txt" line 34: No data in plot现在我到了,我不知道怎么继续
发布于 2019-01-18 22:55:53
Gnuplot找不到数据文件。我认为有两个可能的原因:
脚本有类似于plot "data.txt"的内容,错误消息提到一个文件"data",注意缺少的.txt。=>检查您的脚本和实际文件名,它可能是一个简单的错误或缺少的文件扩展名。
添加命令pwd (打印工作目录)作为脚本中的第一个命令。它将打印期望数据文件所在的目录。如果它不是正确的目录,您可以:
cd命令更改为更正目录plot命令您可以使用load命令,gnuGraph似乎可以找到脚本。因此,我认为数据文件很可能应该与脚本gnuplot2.txt位于同一个目录中。
发布于 2019-01-25 11:14:41
So far, this is the image that I have
实际上,问题是在选择数据所在的目录时。
现在的问题是,我不知道如何才能改变格式,给它一个不同的颜色。另外,我想在每一栏的顶部加上复合标签。
有什么建议吗?
https://stackoverflow.com/questions/54252120
复制相似问题