Q:

Printing custom label every n elements using Gnuplot

I want to create scatter plot of a file that looks like: 
counter  N   x  y   
  1     200  50 50  
  2     200  46 46  
  3     200  56 56  
  4     200  36 36
  5     200  56 56

There are 240 lines in this file. The N is incremented by 200 every 30 lines. 
So, when I plot the numbers I want to create a scatter plot of x, y values vs. counter. Here is my code:
plot "file" using 1:3 title "hb" with points pt 2 ps 1 lc rgb "red", \
     "file" using 1:4 title "ls" with points pt 3 ps 1 lc rgb "blue"

As a result my x-axis has the range [1,240].
The question is that I want the label of my x-axis to contain the values from the second column, and I want them to be printed after every 30 points.
So, I want my x-axis label to be customized as: [200,400,600,800,1000,1200,1400,1600] where they each have 30 points in between.
I actually searched for this question before, found the solution and solved it. So, I know there is an answer somewhere. But apparently I lost my code. I have been searching for the old post for an hour now but could not find it.
Can anyone help me with using customized labels here?

A:

You can evaluate any expression in xticlabel to give a string or an invalid value. In order to set labels only at certain values of column 1, you can use
plot "file" using 1:3:xtic(int($1)%30 == 0 ? strcol(2) : 1/0) title "hb" pt 2 lc rgb "red", \
     "" using 1:4 title "ls" pt 3 lc rgb "blue"

Thr expression xtic(int($1)%30 == 0 ? strcol(2) : 1/0) places the string value of column 2 when the value in column 1 is a multiple of 30. All other values are skipped, because 1/0 is an invalid value.

