在 x 轴上定位标签

Positioning labels on x axis

我正在尝试绘制一个简单的图表,x 和 y 坐标,但是我的轴标签并不完全符合我的意愿。

这是我正在使用的输入:

reset
clear
set output "BytesOverTime.png"
set title "Evolution of Bytes over Time"
set ylabel 'Bytes'
set xlabel 'Time'
set key off
set term png
set xdata time
set timefmt "%Y-%m-%d-%H-%M"
set format x "%Y-%m-%d-%H-%M"
set xtics rotate by 90 nomirror
set datafile separator ' '
set logscale y
plot "timeBytesAverage.out" using 1:2

以及需要测试的文件: http://pastebin.com/raw.php?i=qqpeJj4V

How can I change the '1e+08' and so on to their true value, 100000000

set format y "%f"

或者,因为这会给你十进制数:

set format y "%.0f"

你也可以看看

set format y "%.0s%cByte"

这将创建 MByte、GByte、...(请参见我的图中右侧的 y 轴) 但是,这将以 1000 为底,而不是 1024。

How can I shift the labels of the xtics down so they don't obscure the graph?

set xtics rotate by 90 nomirror right

将右对齐(左对齐)刻度线

Can I print the coordinates in the graph of certian points, for example the dip between 2014-05-10-04-00 and 2014-05-10-08-00?

如果你知道坐标,是的:

set xtics add ("high" "2014-05-09-23-30", "low" "2014-05-10-22-30" )

一般语法是:

set xtics add (  <label1> <position1>, <label2> <position2> , ...)

这会将标签列表添加到自动生成的标签中。如果省略单词 add,将不会自动生成标签,只有列表中的标签。

How can one add more intervals in the labels of the x axis?

set xtics 3600

每 3600 秒即每小时生成一个标签。这不适用于对数刻度轴。

set mxtics 2

将导致两个主要(标记的)抽动之间的间隙被分成两个较小的间隙,即两个主要抽动标记之间的一个次要抽动标记。 (然而,这里似乎没有必要,因为 gnuplot 决定自己使用 2)

结果如下:

注意我也加了

set y2tics
set y2range[1E8:1E12]
set format y2 "%.0s%cByte"
set logscale y2

在右侧 y 轴上演示这种特殊格式。

顺便说一句:y 轴上的标签格式独立于数据文件中的格式。

set timefmt "%Y-%m-%d-%H-%M" 定义文件内的格式

set format x "%Y-%m-%d-%H-%M 定义图中的格式。所以你可能会做一些像 set format x "%Y-%m-%d %H:%M 这样更具可读性的事情。