Skip to main content

Overview

Giac provides comprehensive plotting capabilities for both 2D and 3D graphics, including parametric plots, implicit plots, polar plots, and field plots.

2D Plotting Functions

plotfunc

gen plotfunc(const gen & f, const gen & vars, const vecteur & attributs,
             int densityplot, double function_xmin, double function_xmax,
             double function_ymin, double function_ymax,
             double function_zmin, double function_zmax,
             int nstep, int jstep, bool showeq, GIAC_CONTEXT);
Plots a function or set of functions.
f
gen
The function(s) to plot
vars
gen
The variable(s) to use
attributs
vecteur
Plot attributes (color, style, etc.)
densityplot
int
Whether to create a density plot
function_xmin
double
Minimum x value
function_xmax
double
Maximum x value
nstep
int
Number of steps for evaluation
showeq
bool
Whether to show equation

plotparam

gen plotparam(const gen & f, const gen & vars, const vecteur & attributs,
              int densityplot, double function_xmin, double function_xmax,
              double function_ymin, double function_ymax,
              double function_tmin, double function_tmax,
              double function_tstep, const gen & equation,
              const gen & parameq, const context * contextptr);
Creates parametric plots in 2D.
f
gen
Parametric equation(s)
vars
gen
Parameter variable(s)
function_tmin
double
Minimum parameter value
function_tmax
double
Maximum parameter value
function_tstep
double
Parameter step size

plotimplicit

gen plotimplicit(const gen& f_orig, const gen& x, const gen & y,
                 double xmin, double xmax, double ymin, double ymax,
                 int nxstep, int nystep, double eps,
                 const vecteur & attributs, bool unfactored,
                 bool cklinear, const context * contextptr, int ckgeo2d);
Plots implicit equations in 2D.
f_orig
gen
The implicit equation f(x,y)=0
x
gen
The x variable
y
gen
The y variable
nxstep
int
Number of x steps
nystep
int
Number of y steps
eps
double
Precision tolerance

plotfield

gen plotfield(const gen & xp, const gen & yp,
              const gen & x, const gen & y,
              double xmin, double xmax, double xstep,
              double ymin, double ymax, double ystep,
              double scaling, vecteur & attributs,
              bool normalize, const context * contextptr);
Plots a vector field.
xp
gen
x-component of the field
yp
gen
y-component of the field
xstep
double
Step size in x direction
ystep
double
Step size in y direction
scaling
double
Scaling factor for vectors
normalize
bool
Whether to normalize vectors

plotcontour

gen plotcontour(const gen & f0, bool contour, GIAC_CONTEXT);
Creates contour plots of a function.
f0
gen
The function to plot
contour
bool
Whether to show contour lines

plotseq

gen plotseq(const gen& f, const gen& x, double x0,
            double xmin, double xmax, int niter,
            const vecteur & attributs,
            const context * contextptr, bool print);
Plots a sequence (cobweb plot).
f
gen
The iteration function
x
gen
The variable
x0
double
Initial value
niter
int
Number of iterations

3D Plotting Functions

plotparam3d

gen plotparam3d(const gen & f, const vecteur & vars,
                double function_xmin, double function_xmax,
                double function_ymin, double function_ymax,
                double function_zmin, double function_zmax,
                double function_umin, double function_umax,
                double function_vmin, double function_vmax,
                bool clrplot, bool f_autoscale,
                const vecteur & attributs,
                double ustep, double vstep,
                const gen & eq, const vecteur & eqvars,
                GIAC_CONTEXT);
Creates parametric 3D plots.
f
gen
Parametric equation(s) [x(u,v), y(u,v), z(u,v)]
vars
vecteur
Parameter variables [u, v]
function_umin
double
Minimum u parameter value
function_umax
double
Maximum u parameter value
function_vmin
double
Minimum v parameter value
function_vmax
double
Maximum v parameter value
ustep
double
Step size for u parameter
vstep
double
Step size for v parameter
f_autoscale
bool
Whether to automatically scale the plot

plotimplicit (3D)

gen plotimplicit(const gen& f_orig,
                 const gen& x, const gen & y, const gen & z,
                 double xmin, double xmax,
                 double ymin, double ymax,
                 double zmin, double zmax,
                 int nxstep, int nystep, int nzstep,
                 double eps, const vecteur & attributs,
                 bool unfactored, bool cklinear,
                 const context * contextptr);
Plots implicit equations in 3D.
f_orig
gen
The implicit equation f(x,y,z)=0
x
gen
The x variable
y
gen
The y variable
z
gen
The z variable
nxstep
int
Number of x steps
nystep
int
Number of y steps
nzstep
int
Number of z steps

Utility Functions

ticks

vecteur ticks(double xmin, double xmax, bool bounds);
Generates tick marks for axes.
xmin
double
Minimum value
xmax
double
Maximum value
bounds
bool
Whether to include boundary values
return
vecteur
Vector of tick positions with simple decimal representation

plot_array

gen plot_array(const std::vector<std::vector<double>> & fij,
               int imax, int jmax,
               double xmin, double xmax, double dx,
               double ymin, double ymax, double dy,
               const vecteur & lz, const vecteur & attributs,
               bool contour, int pal, GIAC_CONTEXT);
Plots a 2D array of values.
fij
std::vector<std::vector<double>>
2D array of function values
imax
int
Number of rows
jmax
int
Number of columns
contour
bool
Whether to create contour plot
pal
int
Color palette index

colormap functions

bool is_colormap_index(int pal);
bool is_colormap_cyclic(int pal);
int colormap_color(int pal, double t, GIAC_CONTEXT);
bool colormap_color_rgb(int pal, double t, int &c, int &r, int &g, int &b,
                        GIAC_CONTEXT);
Colormap utility functions for customizing plot colors.
pal
int
Colormap palette index
t
double
Value between 0 and 1 to map to color

Global Variables

extern double gnuplot_xmin, gnuplot_xmax;
extern double gnuplot_ymin, gnuplot_ymax;
extern double gnuplot_zmin, gnuplot_zmax;
extern double gnuplot_tmin, gnuplot_tmax, gnuplot_tstep;
extern double global_window_xmin, global_window_xmax;
extern double global_window_ymin, global_window_ymax;
extern double x_tick, y_tick;
extern bool autoscale;
extern int PARAM_STEP;
extern int gnuplot_pixels_per_eval;
Global variables controlling plot ranges and behavior.

See Also

Build docs developers (and LLMs) love