gnuplot中的网状轴 [英] Re-tic axis in gnuplot
问题描述
我想通过绘制一个带有x轴采样时间点和y轴存储在磁盘上的图形来显示磁盘上已用空间的变化. 但是,当前使用的存储空间是以字节为单位记录的,当值超过GB时,这是人类无法读取的.
I want to show how used space changes on my disk by drawing a figure with x-axis the sampling time point and y-axis storage used on disk. However, currently, the storage used is recorded in bytes, which is not human-readable when value goes beyond GB.
那么,我可以在gnuplot中调整轴的坐标吗?就我而言,是否可以将值100000000
更改为100MB
?
So, could I re-tic axis in gnuplot? In my case, could I change the value 100000000
, for example, into 100MB
?
谢谢和最好的问候.
推荐答案
您有两个主要选择.第一个(可能是最简单的)是在绘制时缩放事物:
You have two main options. The first (and probably easiest) is to scale things when you plot:
plot 'datafile' using 1:($2/1e6) title 'Usage in MB'
这将绘制文件datafile
中的第二个数据列,每个值除以1e6随时间变化(第一列).
This will plot the second data column in the file datafile
with each value divided by 1e6, versus time (first column).
您还可以调整轴的坐标,但这不太通用.
You can also re-tic the axes, but this is a bit less general.
set ytics ("100" 1e8)
另一种选择是在y轴上使用科学计数法(就像我上面对这些大数字所做的那样).为此,命令是
Another option would be to use scientific notation on the y axis (as I have been doing with these big numbers above). To do that, the command is
set format y '%.2e'
这将使用科学计数法在小数点后2位打印y标记.您也可以尝试
This will print the y tics using scientific notation with 2 figures after the decimal point. You could also try
set format y '%.2g'
这将打印出更简洁的科学表示法或常规表示法.
which will print the more compact of either scientific or normal notation.
这篇关于gnuplot中的网状轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!