Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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
click to hide/show revision 2
No.2 Revision

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
click to hide/show revision 3
No.3 Revision

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)
click to hide/show revision 4
No.4 Revision

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)