loginpassword
loginpassword

Reputation: 317

Gnuplot x tic labels overlap

I am drawing a gnuplot chart from datafile with such format:

01 value_1_1 value_2_1
02 value_1_1 value_2_1
...
01 value_1_n value_2_n

using that command:

plot "action.dat" using 2:xtic(1) with boxes ls 1 title "First title",\
     "action.dat" using 3:xtic(1) with boxes ls 2 title "Second title";

X tic labels are loaded from the first column. When terminal is too small, labels start to overlap. How can I hide x tic label if it overlaps previous label? Or, at least, how can I draw only n-th label?

I've tried to do something like that

set xtics 10 rotate by -90

but failed.

Upvotes: 3

Views: 2878

Answers (1)

mgilson
mgilson

Reputation: 309929

To (effectively) plot every nth label, you can use something like:

plot "action.dat" using 2:xtic(int($0)%3==1 ? strcol(1):'') with boxes ls 1 title "First title"

This will actually plot every label, but the ones that aren't the n'th label will just be plotted as empty strings ...

Upvotes: 5

Related Questions