Interface to the Gnuplot interpreter#
- class sage.interfaces.gnuplot.Gnuplot[source]#
Bases:
SageObject
Interface to the Gnuplot interpreter.
- plot(cmd, file=None, verbose=True, reset=True)[source]#
Draw the plot described by cmd, and possibly also save to an eps or png file.
INPUT:
cmd
– stringfile
– string (default: None), if specified save plot to given file, which may be either an eps (default) or png file.verbose
– print some inforeset
– True: reset gnuplot before making graph
OUTPUT: displays graph
Note
Note that
^
s are replaced by**
s before being passed to gnuplot.
- plot3d(f, xmin=-1, xmax=1, ymin=-1, ymax=1, zmin=-1, zmax=1, title=None, samples=25, isosamples=20, xlabel='x', ylabel='y', interact=True)[source]#
- plot3d_parametric(f='cos(u)*(3 + v*cos(u/2)), sin(u)*(3 + v*cos(u/2)), v*sin(u/2)', range1='[u=-pi:pi]', range2='[v=-0.2:0.2]', samples=50, title=None, interact=True)[source]#
Draw a parametric 3d surface and rotate it interactively.
INPUT:
f
– (string) a function of two variables, e.g., ‘cos(u)*(3 + v*cos(u/2)), sin(u)*(3 + v*cos(u/2)), v*sin(u/2)’range1
– (string) range of values for one variable, e.g., ‘[u=-pi:pi]’range2
– (string) range of values for another variable, e.g., ‘[v=-0.2:0.2]’samples
– (int) number of sample points to usetitle
– (string) title of the graph.
EXAMPLES:
sage: gnuplot.plot3d_parametric('v^2*sin(u), v*cos(u), v*(1-v)') # optional - gnuplot, not tested (since something pops up)
>>> from sage.all import * >>> gnuplot.plot3d_parametric('v^2*sin(u), v*cos(u), v*(1-v)') # optional - gnuplot, not tested (since something pops up)