Gnuplot xtics mxtics grid format

How can I define one format for the main grid (xtics, ytics) and the other for secondary ticks (mxtics and mytics)?

I tried:

set style line 100 lt 1 lc rgb "gray" lw 2
set style line 101 lt 1 lc rgb "gray" lw 1
set grid xtics ytics ls 100
set grid mxtics mytics ls 101

But this takes the last defined lw (1) for all grids.

+5
source share
4 answers

It also displays small texts and mytics, but with the same format as the main ticks. And this is a problem when you want to distinguish them. Your decision with arrows did the trick, but it was easier for me to first draw secondary ticks and rewrite them with arrows for the main ones. Tanks.

set style line 100 lt 2 lc rgb "blue" lw 1
set style line 101 lt 1 lc rgb "gray" lw 1

# first draw the minor tics
set xrange [0:1]
set mxtics 10
set yrange [0:1]
set mytics 5
set grid mxtics mytics ls 101

# then the main tics
dx=0.2  #grid spacing in x
set for [i=1:5] arrow from graph i*dx,graph 0 to graph i*dx,graph 1 nohead front ls 100
dy=0.2  #grid spacing in y
set for [i=1:5] arrow from graph 0,graph i*dy to graph 1,graph i*dy nohead front ls 100

plot sin(x)
+4
source
set style line 100 lt 1 lc rgb "gray" lw 2
set style line 101 lt 0.5 lc rgb "gray" lw 1

set grid mytics ytics ls 100, ls 101
set grid mxtics xtics ls 100, ls 101

It really works :).

+4
source

gnuplot , set grid mxtics mytics.

, ( , ):

set style line 100 lt 1 lc rgb "blue" lw 2
set style line 101 lt 1 lc rgb "gray" lw 1
set grid mxtics mytics ls 100, ls 101
+2

In gnuplot, the grid is displayed only at the location of the main tick marks, however, if you want to have two different grids, you can use the arrows:

set style line 101 lt 1 lc rgb "gray" lw 1
dx=.1  #grid spacing in x
set for [i=1:10] arrow from graph i*dx,graph 0 to graph i*dx,graph 1 nohead front ls 101 
set xrange [0:1]
plot sin(x)
+1
source

All Articles