zpavlinovic
zpavlinovic

Reputation: 1547

Gnuplot - grid at specific x and y points

I wanted to rename xtics from numbers to some strings and I did it like this:

set xtics ("one" 1, "two" 2, ...)

At the same time I wanted the grid so I used this:

set grid back

The problem now is that the grid is made so its vertical lines are at 1, 2, etc. Is it possible to make grid where vertical lines are at arbitrary/different places?

Upvotes: 0

Views: 2304

Answers (1)

mgilson
mgilson

Reputation: 309929

You can set the grid to only be drawn where there are minor ticks. Then you can explicitly set the minor ticks the same way you set the major ticks:

set xtics ( "one" 1, "two" 2, "" 3 1 )
#           ^major   ^major   ^minor tick because the "level" is set to 1.
set grid mxtics
plot sin(x)

You can also make it so that the mxtics don't show up:

set xtics scale 1,0

Upvotes: 2

Related Questions