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

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

问题描述

  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 $ b $ 64 64 0.170000 0.020000 $ b $ 128 0.070000 0.000000
256 0.030000 0.000000
512 0.020000 0.000000
1024 0.000000 0.000000

我的gnuplot文件就像给出的一样。
$ b $

 #!/ usr / bin / gnuplot 
重置
设置终端png

set ylabeltime in ms

设置xlabelk

设置标题更新第k个元素
设置键反向左侧
设置网格

设置样式数据线点

设置输出'cache_access.png'
使用1:2标题的图标time_mem_access.datcache access 1 ,\
使用1:3标题cache access 2

图表,我有厕所ks like below。





我的问题是我想让x轴在第一列显示确切的值

 即1,2,4,8,16,32,64等



<

解决方案

而不是调用:

 使用1:2标题cache access 1,\ 
使用1:3绘制time_mem_access.dat titlecache access 2

您可以尝试:

 使用1:2:xtic(1)标题cache access 1绘制time_mem_access.dat,\ 
使用1:3:xtic 1)titlecache access 2

这会给你下面的图:
< img src =https://i.stack.imgur.com/kMt3e.pngalt =在这里输入图片描述>



然而,您可能需要记录x值:

  plottime_mem_access.dat 使用(log($ 1)):2:xtic(1)titlecache access 1,\ 
使用(log($ 1)):3:xtic(1)titlecache access 2

哪个会给你:


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

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.

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.

解决方案

Instead of calling:

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

You can try:

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:

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"

Which would give you:

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

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