atapaka
atapaka

Reputation: 1360

gnuplot grid remove grid from axes lines

gnuplot adds grid lines even on axes, it can cause unpleasant effects:

set logscale x
set xrange [0.01:100]
set xtics font ",12"
set x2tics font ",12"
set mxtics 10
set ytics font ",12"
set y2tics font ",12"
set grid xtics mxtics ytics lt 0 lw 3, lt 0 lw 0.5 behind
set grid
plot sin(x)

Especially if one then plots the above to eps, it looks like there are both logarithmically spaced and linearly spaced tics on the x-axis. Is there any nice way to get rid of the grid lines at axes? A workaround would be to make the axes thicker, but that is not the way I want. I really want to delete those grid lines.

To explain what I mean enter image description here

The linearly spaced tics that are seen in the picture are actually the dotted grid, so it has nothing to do with tics...

Upvotes: 0

Views: 1711

Answers (1)

Ethan
Ethan

Reputation: 15143

As shown, there are both log and linear tics along x. That is because both the x axis and the x2 axis are contributing tics to both the top and bottom borders. You can turn that off with

set tics nomirror

Are you asking how to make the range of the tics smaller than the range of the axes? In the plot you show, that would be

set yrange [-1:1]
set ytics -0.8, 0.2, 0.8
set ytics add (-1 2, 1, 2)

The last command adds back explicit tics at y=-1 and y=1 without generating a corresponding grid line. See documentation for set xtics list

Upvotes: 1

Related Questions