Reputation: 5531
In gnuplot we can write
plot "example.data" using 1:2:ytic(2)
which will put ytics based on y values.
if example.data is like below
10 32
20 43
50 63
ytics would be at 32,43 and 63. How can I make it so it only puts tic using only last line (in that case 63)? I have many colons, and I want to put y value based on last line, so I dont want to put it manually by looking 63 at put a tick there for every colon.
Upvotes: 1
Views: 654
Reputation: 48390
The expression ytic(2)
is more or less a shortcut for ytic(strcol(2))
. So you can take any other expression as argument (also with conditionals) that evaluates to a string.
For you example data you can use the following:
plot "example.data" using 1:2:ytic($0 == 2 ? strcol(2) : 1/0)
That puts a ytic and a label only for the third row. Using 1/0
omits all other tics as well, not only the labels, but procudes "Tic label does not evaluate as string!" warnings. You can safely ignore these, because this is what you want. Using ''
instead of 1/0
would only skip the labels, but draw tics.
In order to make this work for the last line in general, you can use the stats
command (since version 4.6.0) to get the number of entries:
stats 'example.data' using 1 nooutput
plot "example.data" using 1:2:ytic($0 == (STATS_records - 1) ? strcol(2) : 1/0)
Upvotes: 2