7
votes

Using Gnuplot I plot the following graph -

Now, as you can see in the image, it is difficult between the lines, to identify the block at its end. So I will like to color the grid alternately with a different color, or style.

The code right now I use to color the grid is -

set style line 12 lc rgb '#808080' lt 0 lw 1
set grid back ls 12

However, I am not able to find any way to get the grid and set it alternately to another style. Is it even possible in Gnuplot?

What I mean is that, is it possible to have different line style for major and minor tics in grid of gnuplot?

Thanks !

enter image description here

1
I don't get your problem. If you want another style, use another style... set style line 12 lc rgb 'red' lt -1 lw 2. - Christoph
@Christoph I don't want another style. I was the first grid line of style1, second grid line of style2, then third one again of style1 and so on. I want them to be of alternating styles. - Raj

1 Answers

14
votes

Yes, you can use different styles for the minor and major grid lines, see help grid:

set style line 12 lc rgb 'blue' lt 1 lw 2
set style line 13 lc rgb 'red' lt 1 lw 1
set grid xtics ytics mxtics mytics ls 12, ls 13
set mxtics 4
set mytics 4
plot x

The result with 4.6.3 is:

enter image description here