Michal Škultéty
Michal Škultéty

Reputation: 228

how to customize range of xtics in gnuplot histogram?

I plot a histogram in gnuplot, everything works fine expect I want to have customized xtics: my data contains values from 1 to 200 but most of them are at interval 1 to 10, so I wanna have xtics like from 1 at interval 1 and end at 10 and the rest will be with no xtics. The gnuplot places xtics from 0 to 200 if I write it like this:

plot \"$histogram\" u 2:xtic(1) notitle

and If I write this:

set xtics 0,1,10 plot \"$histogram\" u 2 notitle

then gnuplot places "0" xtic to the place of "1" xtic

Thanks in advance

Upvotes: 0

Views: 1476

Answers (1)

Wrzlprmft
Wrzlprmft

Reputation: 4434

First of all, note that both your alternatives place data points according to their line number and not the value in the first column of your data file. Given what you want tics to behave like, this may not be what you want. To avoid this, you have to use a using instruction like u 1:2 or u 1:2:xtic(1).

The command set xtics 0,1,10 explicitly instructs Gnuplot to start tics at 0; if you want tics to start at 1, you need set xtics 1,1,10.

Thus, you probably want:

set xtics 1,1,10
plot "histogram" u 1:2 notitle

However, unless you are more precise about what your datafile looks like and how you want it to be plotted, I cannot be sure.

Upvotes: 0

Related Questions