gnuplot:如何启用千位分隔符(数字分组)? [英] gnuplot: How to enable thousand separators (digit grouping)?

查看:171
本文介绍了gnuplot:如何启用千位分隔符(数字分组)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用svg终端在gnuplot 4.6.5的德语Windows 8.1 64Bit上.如果我绘制具有大数字(例如一百万")的数据文件,则gnuplot不会打印数字分组符号.

I'm on German Windows 8.1 64Bit with gnuplot 4.6.5, using the svg terminal. If I plot datafiles that have big numbers, like "one million", gnuplot does not print a digit grouping sign.

例如,如果我的数据文件具有一百万个数量级的值,则我希望y轴上的数字显示为1.000.000(其中.是组符号,而不是小数点!),但是gnuplot只能给我1000000.

For example, if my datafile has values in the order of one million, I want the numbers at the y-axis be displayed as 1.000.000 (with . being the group sign, not the decimal sign!), but gnuplot gives me just 1000000.

选项set decimalsign locale仅更改小数点(整数和小数部分之间的分隔符,例如1+1/2 = 1,5,其中,是小数点).但是,既不设置decimalsign,也不根本不调用此命令,都不会在图形中显示数字分组符号.我只会看到难看的10000001500000而不是1.000.0001.500.000.

The option set decimalsign locale just changes the decimal sign (separator between whole number and fractional part, like 1+1/2 = 1,5 with , being the decimal sign). But neither setting decimalsign nor not calling this command at all shows digit grouping signs in the plot. I only get ugly 1000000 or 1500000 instead of 1.000.000 or 1.500.000.

我也尝试过

set decimal locale
set format y "%'f"

这使我在所有抽签中都带有标签%'f",而不是数字!每个tic一次又一次地只有%'f".它只是将格式字符串按原样打印到绘图中,根本没有数字.控制台输出为decimal_sign in locale is ,,这对于德语语言环境是正确的,因此gnuplot可以正确识别它.在Windows的控制面板中,千位分隔符也已正确设置为.,小数点也已正确设置为,.

which just gives me at all tics the label "%'f", instead of the numbers! Each tic has just "%'f", again and again. It just prints the format string as is into the plot and no numbers at all. The console output is decimal_sign in locale is , which is correct for german locale, so gnuplot recognizes it correctly. In my control panel of Windows the thousand separator is set correctly to . and the decimal sign to , too.

不能手动设置tic. IE. set ytics add ('1.000.000' 1e6)十二打option的抽搐对我来说是没有选择的.

Setting tic by tic by hand is no option. I.e. set ytics add ('1.000.000' 1e6) for dozenz of dozenz tics is no option for me.

如何自动在gnuplot中获得千位分隔符?

How do I automatically get thousand separators in gnuplot?

推荐答案

在Windows上似乎不起作用.从gnuplot文档中

That seems not to work on Windows. From the gnuplot documentation

国际化(语言环境设置):Gnuplot使用C运行时库例程setlocale()来控制输入和输出数字,时间和日期字符串的特定于语言环境的格式.可用的语言环境以及对语言环境功能(例如千位分组分隔符")的支持程度取决于您的单机提供的国际化支持.

Internationalization (locale settings): Gnuplot uses the C runtime library routine setlocale() to control locale-specific formatting of input and output number, times, and date strings. The locales available, and the level of support for locale features such as "thousands’ grouping separator", depend on the internationalization support provided by your individual machine.

在Windows中使用C打印带有数千个分隔符的整数是不可能的,因为格式字符串中的撇号是Unix的专业知识,而不是C标准.

And judging from questions like How can I add a thousands separator to a double in C on Windows? Printing integers with thousands separators in Windows using C it is not possible since the apostrophe in the format string is a Unix specialty and not a C standard.

我认为没有解决方法可以在Windows上通过自动缩放来实现这一功能.

I think there is no workaround to get this working on Windows with autoscaling.

记录:以下脚本在Linux上运行良好:

For the records: The following script works fine on Linux:

set format "%'.0f"
set xrange [0:1e6]
plot x

这篇关于gnuplot:如何启用千位分隔符(数字分组)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆