# Revision history [back]

You can define a grid as follows:

sage: grid = Graphics()
sage: for i in range(-10,10,1):
....:     grid += line([(i,-10),(i,10)])
....:     grid += line([(-10,i),(10,i)])
sage: grid


Then you can add plots as follows:

sage: t = var('t')
sage: P = plot(sin(2*pi*t), (t,-10,10))
sage: P
sage: P + grid


Matplotlib is already shipped in Sage, and Sage uses it when it deals with plots. You can define a grid as follows:

sage: grid = Graphics()
sage: for i in range(-10,10,1):
....:     grid += line([(i,-10),(i,10)])
....:     grid += line([(-10,i),(10,i)])
sage: grid


Then you can add plots as follows:

sage: t = var('t')
sage: P = plot(sin(2*pi*t), (t,-10,10))
sage: P
sage: P + grid


Matplotlib is already shipped in Sage, and Sage uses it when it deals with plots. You can define a grid as follows:

sage: grid = Graphics()
sage: for i in range(-10,10,1):
....:     grid += line([(i,-10),(i,10)])
....:     grid += line([(-10,i),(10,i)])
sage: grid


Then you can add plots as follows:

sage: t = var('t')
sage: P = plot(sin(2*pi*t), (t,-10,10))
sage: P
sage: P + grid


EDIT: actually, there are gridlines gridlinesstyle and options, see the documentation. Example (without tuning):

sage: plot(sin(2*pi*t), (t,-10,10), gridlines=True)


Matplotlib is already shipped in Sage, and Sage uses it when it deals with plots. You can define a grid as follows:

sage: grid = Graphics()
sage: for i in range(-10,10,1):
....:     grid += line([(i,-10),(i,10)])
....:     grid += line([(-10,i),(10,i)])
sage: grid


Then you can add plots as follows:

sage: t = var('t')
sage: P = plot(sin(2*pi*t), (t,-10,10))
sage: P
sage: P + grid


EDIT: actually, there are gridlines and gridlinesstyle and options, see the documentation. Example (without tuning):

sage: plot(sin(2*pi*t), (t,-10,10), gridlines=True)