linux - gnuplot 上的 x 轴值

标签 linux graph gnuplot

我正在玩 gnuplot。我的数据集是这样的。

1     0.530000  0.510000
2     0.420000  0.310000
4     0.400000  0.160000
8     0.390000  0.070000
16    0.390000  0.040000
32    0.310000  0.020000
64    0.170000  0.020000
128   0.070000  0.000000
256   0.030000  0.000000
512   0.020000  0.000000
1024  0.000000  0.000000

我的 gnuplot 文件是给定的。

#!/usr/bin/gnuplot
reset
set terminal png

set ylabel "time in ms"

set xlabel "k"

set title "update every kth element"
set key reverse Left outside
set grid

set style data linespoints

set output 'cache_access.png'
plot "time_mem_access.dat" using 1:2 title "cache access 1", \
      ""                   using 1:3 title "cache access 2"

我得到的图表如下所示。

enter image description here

我的问题是我希望 x 轴在第一列中显示准确的值

i.e 1,2,4,8,16,32,64 etc.

我在网上找不到任何关于如何准确完成这项工作的文档。

最佳答案

而不是调用:

plot "time_mem_access.dat" using 1:2 title "cache access 1", \
      ""                   using 1:3 title "cache access 2"

你可以试试:

plot "time_mem_access.dat" using 1:2:xtic(1) title "cache access 1", \
      ""                   using 1:3:xtic(1) title "cache access 2"

这将为您提供以下情节: enter image description here

但是您可能想要记录 x 值:

plot "time_mem_access.dat" using (log($1)):2:xtic(1) title "cache access 1", \
      ""                   using (log($1)):3:xtic(1) title "cache access 2"

这会给你: enter image description here

关于linux - gnuplot 上的 x 轴值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17159569/

相关文章:

algorithm - 有向图中的最大流

c++ - BFS 可以找到图中的环吗?

Gnuplot BibTeX 引文

linux - 使用 sendmail 脚本时获取空文件作为附件

linux - 对具有数百万行的大文件进行排序

python - 如何将绘制的图像居中?

Gnuplot:设置第三个(彩色)点的范围

python - 在 mac os x 上安装 gnuplot 时出现问题

json - 交换键和值并累加值

linux - 无法连接到 docker 容器外部的 oracle :12. 1.0.2