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

发布于 2025-01-12 03:44:06 字数 1476 浏览 1 评论 0原文

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

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 

结果图:

在此处输入图像描述

My old script worked fine years ago.

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

Now result in graph with only rounded integer points in y(vertical) axe. I dont understand why.
Example data in file:

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 

Result graph:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嗳卜坏 2025-01-19 03:44:06

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

添加一行

set decimalsign locale "german"

set decimalsign locale "french"

检查帮助十进制符号

<前><代码>语法:

设置小数符号 {<值>; |语言环境 {"<语言环境>"}}

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

 设置小数点','

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

Maybe the local setting of your system (or something in gnuplot) has changed?
The following works for me with your data.

Add a line

set decimalsign locale "german"

or

set decimalsign locale "french"

Check help decimalsign.

Syntax: 

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

Correct typesetting in most European countries requires:

  set decimalsign ','

Please note: If you set an explicit string, this affects only numbers
that are printed using gnuplot's gprintf() formatting routine,
including axis tics. It does not affect the format expected for input
data, and it does not affect numbers printed with the sprintf()
formatting routine.

亣腦蒛氧 2025-01-19 03:44:06

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 

在此处输入图像描述

The answer given by theozh is correct, but it does not point out the unfortunate lack of standardization about how different operating systems report the current locale setting. For linux machines the locale strings are less human-friendly. For example instead of using something generic like "french", they subdivide into "fr_FR.UTF-8" "fr_BE.UTF-8" "fr_LU.UTF-8" etc to account for slight differences in the conventions used in France, Belgium, Luxembourg, etc.

I cannot tell you the exact set of locale descriptions on your machine, but here is what works for me on a linux machine:

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 

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文