为什么 gnuplot 对纵轴列中的数据进行舍入?

问题描述 投票:0回答:2

我的旧脚本几年前运行良好。

set terminal png background "#ffffff" enhanced fontscale 2.0 size 1800, 1400 
set output 'delete.png'
w=1
x=1  
z = 60 
y=2
plot 'plot.in.tmp' using (column(x)/z):(column(y)) axis x1y1 with lines 
exit gnuplot
reset

现在生成的图表在 y(垂直)轴上仅具有舍入整数点。我不明白为什么。 文件中的示例数据:

0     -0,00        0,5    570,2    11,98     -0,121      0,000        9,6 
5     -0,00        0,7    570,2    11,97     -0,002      0,012       13,2 
10     -0,00        0,9    570,3    11,98     -0,004     -0,000       16,1 
15      0,24       35,9    570,4    11,96      0,001      0,000       18,4 
20      0,56       87,0    570,1    11,99     -0,001     -0,000       20,5 
25      1,03      173,5    570,4    11,97     -0,000      0,000       23,2 
30      1,61      296,4    570,3    11,96      0,002      0,000       12,4 
35      2,17      422,6    570,2    11,68      0,004      0,000        8,8 
40      2,81      571,6    570,2    11,37      0,010      0,001        7,5 
45      3,52      752,3    570,3    11,26      0,015      0,000        7,1 
50      3,97      905,0    570,2    11,69      0,075      0,006        7,4 
55      4,36     1048,4    570,1    11,36      0,081      0,001        8,6 
60      4,59     1156,8    570,2    11,22      0,087      0,001       10,7 

结果图:

gnuplot
2个回答
1
投票

也许您的系统(或 gnuplot 中的某些内容)的本地设置已更改? 以下内容对我来说适用于您的数据。

添加一行

set decimalsign locale "german"

set decimalsign locale "french"

检查

help decimalsign

Syntax: 

      set decimalsign {<value> | locale {"<locale>"}}

大多数欧洲国家的正确排版要求:

  set decimalsign ','

请注意:如果您设置显式字符串,则只会影响数字 使用 gnuplot 的 gprintf() 格式化例程打印, 包括轴抽动。它不会影响输入的预期格式 数据,并且它不影响使用 sprintf() 打印的数字 格式化例程。


0
投票

theozh 给出的答案是正确的,但它并没有指出不同操作系统如何报告当前区域设置缺乏标准化。对于 Linux 机器,区域设置字符串不太人性化。例如,它们不使用“french”等通用名称,而是细分为“fr_FR.UTF-8”“fr_BE.UTF-8”“fr_LU.UTF-8”等,以考虑法国、比利时使用的约定中的细微差异、卢森堡等

我无法告诉您计算机上的确切语言环境描述集,但以下是在 Linux 计算机上对我有用的内容:

set decimalsign locale "fr_FR.UTF-8"
w=1
x=1  
z = 60 
y=2
plot 'plot.in.tmp' using (column(x)/z):(column(y)) axis x1y1 with lines 

© www.soinside.com 2019 - 2024. All rights reserved.