2011-11-15 61 views
0

我想绘制该数据文件错误绘制标签gnuplot的

“/root/temp.txt”

LB|30|421 
CN|50|247 
BR|20|370 
SA|12|310 

其中第一列是X轴,第二个是Y轴,第三个标签放在直方图的每一列上方。

此之前,我用这个语法来绘制图形(但无任何标签)

set terminal png ; 
set title "Hello" ; 
set xlabel "Country" ; 
set ylabel "values" ; 
set style fill solid ; 
set xtic rotate -45 ; 
set datafile separator "|" ; 
set style data histograms ; 
plot '/root/temp.txt' using 2:xtic(1) notitle 

但是,如果我尝试添加标签GNU情节给我的错误!

我用它来添加标签的语法 情节 '/root/temp.txt' 使用2:xtic(1):3与标签notitle

你能帮我吗? 谢谢

+0

你还可以发布你如何试图添加标签?然后,更容易看到发生了什么问题。 – Woltan

+0

我想添加标签(第3列)。如果我尝试使用2:xtic(1):3绘制'/root/temp.txt'与标签notitle它使错误...! – user1047926

回答

0

我不知道,你可以压缩成一个绘图格式,但可以使用replot(或重制式情节):

plot '/root/temp.txt' using 2:xtic(1) notitle, '' u ($0):2:3 with labels notitle 

空'诱导重用的最后一个输入(文件)。现在,它与 '/root/temp.txt' 等于

Solution with semi-replot

为了更好:

plot 'temp.txt' using 2:xtic(1) notitle, '' u ($0+0.1):($2+1):3 with labels notitle 

Shifted label

哦!不要忘记set output的PNG术语!