Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot, how to add a grid without ticks?

Tags:

gnuplot

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?

like image 431
user3837219 Avatar asked Jul 14 '14 14:07

user3837219


People also ask

What is Ytics in gnuplot?

The set ytics command controls major (labelled) tics on the y axis. Please see set xtics (p. ) for details.

What is gnuplot Xtics?

Fine control of the major (labelled) tics on the x axis is possible with the set xtics command. The tics may be turned off with the unset xtics command, and may be turned on (the default state) with set xtics. Similar commands control the major tics on the y, z, x2 and y2 axes.


2 Answers

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.

like image 149
Christoph Avatar answered Oct 07 '22 02:10

Christoph


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

like image 32
Miguel Avatar answered Oct 07 '22 00:10

Miguel