3

I want to plot some stockpile data.
The data is located in a csv-file and I already got an almost accurate plot, so reading from file isn't the problem.

set terminal pdf
set output "gnuplot/".MATNUM."-2012.pdf"

set datafile separator ";"

stats 'Stock-2012.csv' every ::4::18 using MATNUM nooutput

set border 3
set tics nomirror
set xzeroaxis

set xrange[0:14]
set xtics 1,1,13
set xtics rotate 90

set ylabel MATUNIT

maxplot = sprintf("Amount max:\n%.2f ".MATUNIT, STATS_max)
plot 'Stock-2012.csv' every ::4::18 using ($0+1):MATNUM:xticlabels(2) with linespoints title "Amount", STATS_max with lines lc rgb 'blue' title maxplot

Where MATNUM and MATUNIT are commandline arguments, representing materialnumber (which is the columntitle in the datafile) and the unit in which the material is measured.

The x-values in my datafile are decimals, but gnuplot seems to cut off the fractional digits. For example 12,98 (commata are used as decimal separator, because it's a german stockpile) results in a datapoint at y=12.
I'm not sure but I think this happens only at the maximum and minimum y-value, as STATS_max is an integer every time.

What can I do to get my points at the right y-value?

4

1 回答 1

4

不幸的是,您没有显示文件中的任何数据,但我猜您使用逗号作为小数分隔符。在这种情况下,您需要设置正确的十进制符号来读取输入。你可以使用例如

set decimalsign locale

或使用明确的语言环境(必须安装)

set decimalsign locale "de_DE.UTF-8"

请注意,设置显式字符 withset decimalsign ','不起作用,因为它通常只影响例如 tic 的输出格式,而不影响输入行为。

于 2013-08-12T12:24:31.480 回答