Show Y Label In Groups With Gnuplot

I have the following items:

0.00049 1.509
0.00098 1.510
0.00195 1.511
0.00293 1.509
0.00391 1.510
0.00586 1.523
0.00781 1.512
0.01172 1.514
0.01562 1.510
0.02344 1.511
0.03125 1.510
0.04688 7.053
0.06250 7.054
0.09375 7.187
0.125 7.184
0.1875 7.177
0.25 7.207
0.375 16.588
0.5 24.930
0.75 39.394
1 56.615
1.5 77.308
2 84.909
3 89.056
4 88.485
6 88.678
8 89.022
12 88.513
16 88.369
24 88.512
32 88.536
48 87.792
64 87.716
96 87.589
128 87.608
192 87.457
256 87.388

And this gnuplot script:

#! /usr/bin/gnuplot

set terminal png
set output "lat_mem_rd.png"
set title "Memory Latency Benchmark (Stride 512)"

set xlabel "Memory Depth (MB)"
set ylabel "Latency (ns)"
set xtics rotate by 45 offset 0,-1
set xtics font "Times-Roman, 8"

set grid

set style line 1 lc rgb '#0060ad' lt 1 lw 2 pt 7 ps 1   # --- blue

plot "lat_mem_rd.dat" using (log($1)):2:xtic(1) smooth unique title "" with linespoints ls 1

which generates this graphic:

Graphic generated

But I want to show the y values ​​in the y label as one of the approximate values ​​in these approximations, for example, for all values ​​with x values ​​from 3 to 256, only one label is set, maybe 88.513, which corresponds to x = 12 or another (or maybe the average of these points, if it's not very difficult) ...

The same is true for x values ​​between 0 and 0.02344 and for x values ​​between 0.03125 and 0.1875.

These y values ​​will replace the values ​​10, 20, ..., 90.

+4
source share
1 answer

script, , , :

set title "Memory Latency Benchmark (Stride 512)"

set xlabel "Memory Depth (MB)"
set ylabel "Latency (ns)"
set xtics rotate by 45 offset 0,-1
set xtics font "Times-Roman, 8"

set grid

a = ""; p = 0; nn = 1; nt = 37; d = 4; s = 0

f(x) = (x>p+d || nn >= nt)?(nn=nn+1, p=x, a=a." ".sprintf("%5.2f", s/n), n=1, s=x):(nn=nn+1, p=x, s=s+x, n=n+1)

plot "lat_mem_rd.dat" using 1:(f($2)) # Just to set array "a"

set ytics 0,0,0

set yrange [0:90]

set for [aa in a] ytics add (aa aa)

set style line 1 lc rgb '#0060ad' lt 1 lw 2 pt 7 ps 1   # --- blue

set terminal png
set output "lat_mem_rd.png" 

plot "lat_mem_rd.dat" using (log($1)):2:xtic(1) smooth unique title "" with linespoints ls 1

script :

enter image description here

Y , Y , , d; "a", , ytic . , Y ytic ; , , .

+18

All Articles