user3837219
user3837219

Reputation: 123

Gnuplot, how to add a grid without ticks?

I have something like:

set grid xtics lt 0 lw 1 lc rgb "#a9a9a9"
set grid ytics lt 0 lw 1 lc rgb "#a9a9a9"

or the same without the "xtics" tag, and that works fine! But if i add:

unset xtics

Then the grid disappears too :(

How can I only have a grid, without tics?

Upvotes: 12

Views: 13991

Answers (2)

Christoph
Christoph

Reputation: 48390

To hide the major ticks, you can use set tics scale 0:

set grid
set tics scale 0
plot x

enter image description here

Note, if one day you also want to use minor ticks and also hide them, you must use set tics scale 0,0.001.

Upvotes: 18

Miguel
Miguel

Reputation: 7627

If you only want to make the tic labels disappear then use set format:

set format x ""
set format y ""
set grid
plot x

enter image description here

If you don't want the tics either, then as far as I know you'd need a more complicated script, possibly using iterators and arrows, for example the following (you'll have to change the limits depending on your xrange and yrange and the arrow style to your liking):

unset xtics
unset ytics
set for [i=-5:5:5] arrow from i,-10 to i,10 nohead
set for [j=-5:5:5] arrow from -10,j to 10,j nohead
plot x

enter image description here

Upvotes: 11

Related Questions