gnuplot 上的 x 轴值 [英] x-axis value on gnuplot

查看:33
本文介绍了gnuplot 上的 x 轴值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在玩 gnuplot.我的数据集看起来像这样.

I am playing around with gnuplot.My data set looks like this.

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 文件是给定的打击.

My gnuplot file is as given blow.

#!/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"

我得到的图表如下所示.

The graph that I got looks like below.

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

My problem is that I want the x-axis to show the exact values in the first column

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

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

I can't find any documentation online on how to get exactly this done.

推荐答案

而不是调用:

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"

这将为您提供以下情节:

Which will give you the following plot:

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

However you might want to take a log of the x values:

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"

哪个会给你:

这篇关于gnuplot 上的 x 轴值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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