Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Grid with lines at minor tics

6,573 views
Skip to first unread message

Bill Schwab

unread,
Feb 28, 2010, 3:35:52 PM2/28/10
to
Hello all,

I am trying to create graphs for an audience that knows what they
want, among the requirements is a grid with major and minor lines.
The following is close to what I need (using a simple function in
place of real data an ranges):

set yrange [*:*]
set xrange [-2:2]
set xtics 1
set ytics 1
set mxtics 4
set mytics 4
set grid mxtics mytics xtics ytics -1 0
plot x**2 axes x1y1

The major lines should be heavier that in the result, and I might
prefer to use a "lighter" dash pattern for the minor lines. The
problem is that I cannot figure out what is making this much work.
Gnuplot in Action is a great book, but it does not say much about
grids, and the little I have found elsewhere is almost silent on minor
lines.

Any ideas?

Bill

sfeam

unread,
Feb 28, 2010, 7:19:50 PM2/28/10
to
Bill Schwab wrote:

> Hello all,
>
> I am trying to create graphs for an audience that knows what they
> want, among the requirements is a grid with major and minor lines.
> The following is close to what I need (using a simple function in
> place of real data an ranges):
>
> set yrange [*:*]
> set xrange [-2:2]
> set xtics 1
> set ytics 1
> set mxtics 4
> set mytics 4
> set grid mxtics mytics xtics ytics -1 0
> plot x**2 axes x1y1
>
> The major lines should be heavier that in the result, and I might
> prefer to use a "lighter" dash pattern for the minor lines.

> The problem is that I cannot figure out what is making this much work.

> set grid mxtics mytics xtics ytics -1 0

Let's break this into two separate commands

# turn on all the grid lines


set grid mxtics mytics xtics ytics

# set the line types
set grid -1 0

The "-1" is the linetype used for major tic grid lines
The "0" is the linetype used for minor tic grid lines

However, the particular command is given using a now-deprecated syntax
that omits all the keywords that would help you figure out how to
modify it. The equivalent modern command would be

set grid lt -1 lt 0

And if you look at the output from "help set grid" you will see
that you can specify line styles as an alternative to linetypes.
So to get a heavier line style:

set style line 1 linetype -1 linewidth 3
set grid ls 1 lt 0

Gnuplot does not yet offer a terminal-independent way of altering
the dot/dash style. For some terminal types you could make it
lighter by choosing a line width < 1. For some you can alter the
dash length also.

> Gnuplot in Action is a great book, but it does not say much about
> grids, and the little I have found elsewhere is almost silent on minor
> lines.

Nothing special about them. You can use the same style options
as other lines.

> Any ideas?
>
> Bill

0 new messages