﻿ Euler Math Toolbox - Reference

# Basic Plot Functions

## Content

Help functions for 2D and 3D plots.

## Support functions for Plots

It should not be necessary to call these functions directly, unless a special effect is needed. You can use plot2d or plot3d instead. Have a look at the following notebook.

There are also some core functions, which are not explained here. Look at the following documentation, if you need those.

Moreover, some of the following functions link to core functions for further details.

```function overwrite window
```
```  window(c1,r1,c2,r2) sets a plotting window.
The coordinates must be screen coordinates.
window() returns the active window coordinates.

See:   coordinates (Euler Core)
```
```function fullwindow
```
```  Takes the full size (besides a title) for the plots
Should only be used for plotRGB

See:   shrinkwindow (Basic Plot Functions),   reset (Basic Utilities),   reset (Maxima Documentation)
```
```function shrinkwindow (smaller=false, square=true)
```
```  shrinkwindow() shrinks the window to allow labels.

This sets the default plot window, leaving place for the labels at
the left and the button, and for the title line. For more space,
use fullwindow. If you need larger labels at the y-axis, set
>smaller. If you want to have an exact 1:1 square plot use >square.

See:   fullwindow (Basic Plot Functions),   reset (Basic Utilities),   reset (Maxima Documentation)
```
```function overwrite setplot
```
```  setplot(xmin xmax ymin ymax) sets the plot coordinates and holds the plot
Also setplot([xmin,xmax,ymin,ymax]).
setplot() resets it.
```
```function overwrite aspect (w:positive number=none,
h:positive number=1, reset=true)
```
```  Set the window aspect to w times h.

This function reduces the plot window to a new window with
proportions w times h. The font size remains the same as in the
full window. To export such a plot, use the crop feature.

If an aspect with larger width is active, insimg will insert only
the active portion of the window.

Without parameters, the function resets to the default window.

Returns the current window ratio.

Example:
>aspect(2); plot2d("sin(x)",0,2pi); insimg(); aspect();

See:   insimg (Euler Core),   insimg (Basic Plot Functions)
```
```function unclip
```
```  Clips to the complete graphics screen
```
```function overwrite clip
```
```  clip(c1,r1,c2,r2) sets the clipping window.
The coordinates must be screen coordinates.
clip() returns the active clipping window coordinates.
```
```function clipmore (x,more=0)
```
```  Sets the clipping window.
The coordinates must be screen coordinates.
There is some extra space around the area x
clip() returns the active clipping window coordinates.
```
```function overwrite args toscreen (x,y=none)
```
```  Convert the x-y-coordinates screen coordinates,
from 0..1024. Useful for Labels.
```
```function overwrite args fromscreen (c,r=none)
```
```  Convert the screen coordinates v[1],v[2] to x-y-coordinates,
Returns {x,y}
```
```function label (text, x:number, y:number, offset=10, ..
color=none, ypos="l", xpos="r", pos=none)
```
```  Label the x-y-value with the text t.

Labels a point in plot coordinates. The position of the label is
by default at the lower right of the point.

text : String or vector of strings (one for each line).
x,y : Position in plot coordinates.
offset : In screen coordinates 0..1024.
color : Color of the label.
ypos : One of "u", "c", "l" (upper, center, lower)
xpos : One of "l", "c", "r" (left, center, right)
pos : Combination of ypos and xpos, such as "ur"

Examples:
plot2d("x^2",r=2); label(["Ursprung","(0,0)"],0,0):

>function f(x) := x^3-x; ...
>  plot2d("x^3-x",r=2);  ...
>  label("Min",1/sqrt(3),f(1/sqrt(3)),pos="lc");  ...
>  label("Max",-1/sqrt(3),f(-1/sqrt(3)),pos="uc"):

See:   labelbox (Basic Plot Functions)
```
```function labelbox (labels, styles="-", colors:real=1,
x=0.98, y=0.02, style="O#", color=0,
w=none, points=0, tcolor=red)
```
```  Plot a box with labels and line styles for the functions.

A label box is a list of labels for each function in the plot. The
box shows a string and a line in the style and color of the
function for each function. For point plots the box can show point
styles.

labels : string, or vector of strings
styles : string or string of vector, styles of the functions
colors : real vector, colors of the functions
w : width of the box (fraction of plot window)
x, y : upper right corner of label box (fractions)
points : flag or vector of flags.

Example:
>labelbox(["x+x^3","x^4"],colors=[black,blue],styles=["-","--"]):

See:   label (Maxima Documentation)
```
```function textbox (text, x=0.98, y=0.02,
style="O#", color=0,
tcolor=red, w=none)
```
```  Plot a box with text.

x,y : An anchor for the upper left corner of the box (fractions of
plot area)
text : A string or a vector of strings, one for each line of text
tcolor : a color or an array of colors for the text lines
w : an optional width of the box (fraction of plot area)

See:   label (Basic Plot Functions),   label (Maxima Documentation)
```
```function plotbar1 (x:number,y:number,w:number,h:number)
```
```  Plots a single bar with x,y,w,h in plot coordinates.
use barstyle and barcolor to modify the bar.
The parameters may be vectors.
```
```function plotbar (x,y,w,h)
```
```  Plots a bars with x,y,w,h in plot coordinates.
use barstyle and barcolor to modify the bar.
The parameters may be vectors.
```
```function xplotbar (x,y,w,h,st:string="#O")
```
```  Plots a bar with x,y,w,h in plot coordinates.
Uses the plot coordinates from the last plot!
Use setplot to set new plot coordinates.
Draws coordinates below the bar.
use barstyle and barcolor to modify the bar.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function xplotrange (r:real vector, v:real vector)
```
```  Plots a barplot of the multiplicities v[i] in the ranges r[i],r[i+1].

Obsolete. Use plot2d with the histogram=1 option.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function scalematrix (A)
```
```  Scales a matrix A, so that its value are in the range from 0 to 1.
```
```function args select
```
```  Coordinates {x,y} of mouse clicks, stops if user clicks above the window.
until the user clicked above the plot window.

See:   mouse (Euler Core)
```

## Plotting Text

```function settitle (text:string, color=none)
```
```  settitle(text) plots a title to the grafik window.
```
```function textheight
```
```  Height of a letter.
```
```function textwidth
```
```  Width of a letter.
```
```function ticks (aa=0,bb=0)
```
```  Returns the proper ticks to be used for intervals [a,b]
and the factor f of the ticks.

See:   xplot (Basic Plot Functions)
```
```function xplot (x=0,y=0,grid=2,ticks=1,frame=1)
```
```  Works like plot, but shows axis ticks.
xplot() shows only axis ticks and the grid.

See:   plot (Euler Core),   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function xmark (x=0,y=0,grid=2,ticks=1)
```
```  Works like mark, but shows axis ticks.
xmark() shows only axis ticks and the grid.

See:   mark (Euler Core),   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function setplotm
```
```  The user can choose the plotting coordinates with the mouse
Returns plot coordinates.
```
```function niceform (x,n=10)
```
```  Return a string, containing a nicely formatted of x
```
```function gridstyle (st1:string="--", st2:string=".",
color=3, textcolor=2, framecolor=3)
```
```  Set the grid styles and colors and the frame color.

See:   linestyle (Euler Core),   rgb (Basic Plot Functions)
```
```function gridcolor (c:integer=3)
```
```  Set the grid color.
Returns the current color
See plot2d,rgb
```
```function xgrid (xx, f=1, grid=2, ticks=1, color=none, ..
xt=none, ylevel=none, textcolor=none)
```
```  Draws vertical grid lines on the plot window at x0,x1,...
xgrid([x0,x1,...],f) additionally writes x0/f to the axis.

f : factor (like 10^5)
grid : 2 for normal grid (see plot2d)
ticks : write labels below the axis
color : tick color
xt : use these numbers for the grid
ylevel : draw the grid at this y level

The default values for the gridstyles are defaultgrid1,
defaultgrid2,defaultgridcolor

See:   ygrid (Basic Plot Functions),   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function ygrid (yy, f=1, grid=2, ticks=1, color=none, ..
yt=none, xlevel=none, textcolor=none)
```
```  Draws horizontal grid lines on the plot window at y0,y1,...
ygrid([x0,x1,...],f) additionally writes x0/f to the axis.

Parameters similar to xgrid

See:   xgrid (Basic Plot Functions),   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function yaxis (x, yy=none, yt=none,
color=none, textcolor=none, style=none, gridstyle=none,
grid=false, vertical=false, left=false, axis=true)
```
```  Draws a y-axis to the plot window

This function manually draws an axis with labels and grid lines
vertical to the axis.

x : x-coordinate of the axis
yy : y-axis ticks of the axis (none: no ticks)
yt : labels of axis ticks (real or string vector, none: take yy)
color,style : color and style of axis
textcolor : color of labels
gridstyle : style of grid lines (rectangular to axis)
grid : draw grid lines (true or false)
vertical : draw labels vertically
left : draw labels left of axis
axis : draw axis line (true or false)

>fullwindow(); setplot(0,1.05,0,1.1); clg;
>xaxis(0,0:0.1:1,style="->");
>yaxis(0,0.1:0.1:1,style="->",>left);
>yaxis(1,style=".",>grid);
>yaxis(1.05,[1,0.5,0.25],>grid,<axis);

See:   xaxis (Basic Plot Functions),   xaxis (Maxima Documentation)
```
```function xaxis (y, xx=none, xt=none,
color=none, textcolor=none, style=none, gridstyle=none,
grid=false, top=false, axis=true)
```
```  Draws a y-axis to the plot window

This function is similar to yaxis().

top : labels on top of the axis

See:   yaxis (Basic Plot Functions),   yaxis (Maxima Documentation)
```
```function xrange ()
```
```  Writes the range of x below the x axis
```
```function xlabel (text,l=1)
```
```  Puts the label text at the x-axis at point l in [0,1]
```
```function yrange ()
```
```  Writes the range of y besides the y axis.
```
```function ylabel (text,l=1,edge=true,vertical=none)
```
```  Puts the label text at the x-axis at point l in [0,1]
```
```function plotwindow
```
```  Sets the plot window to the screen coordinates.

This function is used to make the screen coordinates and the plot
```
```function getwindowfromplot
```
```  Get the window coordinates from the plot coordinates

This is useful for plotrgb.

>getwindowfromplot()
```

Windows

```function upperwindow (title="")
```
```  Select the upper half of the plot window for a plot

See:   figure (Basic Plot Functions)
```
```function lowerwindow (title="")
```
```  Select the lower half of the plot window for a plot

See:   figure (Basic Plot Functions)
```

```function args adaptiveeval (f\$,g\$,a,b,eps=0.01,amin=1e-5,amax=1e5)
```
```  Compute f\$(x), g\$(x) for t in [a,b] with adaptive step size.
eps is the target accuracy.
amin and amax are the minimal and maximal step size.
amax is also the initial step size.
f and g can be expressions in x or user defined functions.
Returns {x,y}

Used by plot2d with the adaptive=1 parameter.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function args adaptiveevalone (g\$:string, a:number, b:number, ..
eps=0.01, amin=0.00001, amax=0.01, square=1)
```
```  Compute g(x) for t in [a,b] with adaptive step size.
eps is the target accuracy.
amin and amax are the minimal and maximal step size (rel to b-a).
amax is also the initial step size.
f and g can be expressions in x or user defined functions.
Returns {x,y}

Used by plot2d with the adaptive=1 parameter.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```

## Colors

Euler can use any color with the rgb function.

But there are 16 pre-defined functions, which use the integer indices 0-15: white=0,black=1,red=2,green=3,blue=4, cyan=5, olive=6, lightgray=7, gray=8, darkgray=9, orange=10, lightgreen=11, turquoise=12, lightblue=13, lightorange=14, yellow=15.

Moreover, there are special colors: 255 for transparent grid plots, -1, -2 for spectral colors in hue plots.

```function rgb (r,g,b)
```
```  Computes a RGB color from [0,1]-values

Returns an integer encryption of the color.
Use to set rgb colors instead of a color index,
and to define an image to be saved on disk.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation),   putred (Euler Core),   putgreen (Euler Core),   putblue (Euler Core),   savergb (Euler Core)
```
```function args getrgb (x)
```
```  Computes the red, green and blue parts from an rgb color.

Used to decompose image pixels into colors.
Returns {r,g,b}

See:   getred (Euler Core),   getblue (Euler Core),   getgreen (Euler Core),   loadrgb (Euler Core)
```
```function computehue (x,y,z,L=[0,0,1],amb=0.1,max=0.9,hue=1)
```
```  Computes the hue value for the vector.

This is used in various plot functions
```

## Save Images to Files

This can should be done in the menu. But there are also functions for Euler scripts.

```function overwrite savepng (filename:string, w:integer=0, h:integer=0, ..
antialias:integer=1)
```
```  Save the current graphics as PNG file in current directory.

Saves the current graphics in PNG format. If antialias=1, then
the function takes more time, and needs more memory, but the output
looks smoother. If w=0, "savepng" uses the screen width. If h=0,
the current aspect ratio with the current width is used.

The current directory is set by the "cd" command, or, if a
notebook is saved or opened.

See:   savesvg (Basic Plot Functions),   saveps (Basic Plot Functions)
```
```function overwrite savesvg (filename:string, w:integer=0, h:integer=0)
```
```  Save the current graphics as SVG file in current directory.

Saves the current graphics in the format SVG (scalable vector
format). If h=0, the current aspect ratio with the current width is
used.

The current directory is set by the "cd" command, or, if a
notebook is saved or opened.

See:   savepng (Basic Plot Functions),   saveps (Basic Plot Functions)
```
```function overwrite saveps (filename:string)
```
```  Save the current graphics as EPS file in current directory.

Saves the current graphics in EPS (encapsulated postscript) format.

The current directory is set by the "cd" command, or, if a
notebook is saved or opened.

See:   savepng (Basic Plot Functions),   savesvg (Basic Plot Functions)
```
```function fcd (f\$,xmin=-1,xmax=1,ymin=-1,ymax=1,n=50,nc=50,maps=0)
```
```  Plots a function of two variables or expression of x and y

This function uses density and contour.
fcd uses map for the evaluation of the function "f".

Obsolete, since plot2d should be used now.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function fcontour (f\$,xmin=none,xmax=1,ymin=-1,ymax=1,r=none,
n=40,nc=20,hue=0,niveau="auto",
contourcolor=none, contourwidth=1,style="#",outline=1)
```
```  Draw contour lines of a function or expression in x and y.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function datacontour (Z:real,
a:number=0, b:number=1, c:number=0, d:number=1,
nc=20, hue=0, niveau="auto",
contourcolor=none, contourwidth=1, style="#", outline=1)
```
```  Draw contour lines of a data matrix.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function fniveau (f\$,niveau=0,xmin=-1,xmax=1,ymin=-1,ymax=1,n=50,maps=0)
```
```  Draw contour lines of a function or expression in x and y

Obsolete, since plot3d should be used now.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function frotate (f\$,a,b,n=40,nt=40,scale=1,frame=1, ..
xlabel="x",ylabel="y",zlabel="z")
```
```  Show a rotated plot of a function

Obsolete, since plot3d with user=1 should be used now.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function triangle
```
```  Obsolete function
```
```function f3dimplicit (f\$:string, x:real vector, y:real vector, z:real vector, ..
fr:integer=1, xlabel:string="x", ylabel:string="y", zlabel:string="z", ..
scale:real=1, direction:integer=4, maps=0, ..
contourcolor=8, contourwidth=1)
```
```  Implicit 3D plot contours at z-values.
```
```function solidhue (x:real, y:real, z:real, h:real,
f:number=1, niveau=none, nc:index=20, values=none,
contourcolor=8, contourwidth=1,
dl=none, breaks=none, limits=none)
```
```  Shaded solid 3D-plot of x,y,z

h is the shading and should run between 0 and 1.
f determines, if h is scaled to fit in between 0 and f.

See:   solid (Euler Core),   solidhuecontour (Euler Core),   solidhuecontour (Basic Plot Functions),   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function solidhuecontour (x:real, y:real, z:real, h:real,
v:real, w:real, breaks=none, limits=none)
```
```  Shaded solid 3D-plot with contour lines.

This function is just for compatibility with older Euler files. It
calls the built-in solid function.

See:   solid (Euler Core),   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function drawbutton (text:string, x:real scalar, y:real scalar, w:real scalar)
```
```  Draw a button with the text at x,y with w character width. x
centered and y top of the label. Return the button rectangle. This
function can be used to program user interaction with clicks onto
the screen.

See:   inbutton (Basic Plot Functions)
```
```function inbutton (b:real vector, s:real vector)
```
```  Test if the screen coordinates s are with in the button rectangle b.
Get s with toscreen(mouse()) to ask the user for a click.

See:   drawbutton (Basic Plot Functions),   mouse (Euler Core)
```
```function fplot (f,a=0,b=0,n=200,grid=2)
```
```  Plots the function f in [a,b]

fplot("f") or fplot("f",,,n,...) plots f in the old interval.
fplot uses map for the evaluation of the function "f".
ffunction may be an expression in x.

Deprecated!

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function f3dplotlight (f\$,xmin=-1,xmax=1,ymin=-1,ymax=1,n=40,
scale=1,fscale=1,light=[0,0,1],amb=0.1,max=0.9,fr=1,
xlabel="x",ylabel="y",zlabel="z",niveau=none,hue=1,
maps=0,contourcolor=8,contourwidth=1,
dl=none,limits=none)
```
```  Plots a function f(x,y,...) in a square.

Also f3dplot("f",xmin,xmax,ymin,ymax,n;...).
f3dplot uses map for the evaluation of the function "f".
"f" may be an expression in x and y.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function f3dplotpolarh (f\$,rmax=1,n=20,scale=1,fscale=1,frame=1, ..
xlabel="x",ylabel="y",zlabel="z",niveau=none,hue=1, ..
maps=0)
```
```  Draw a function defined on the circle with radius rmax.

f3d uses map for the evaluation of the function "f".
n is the spacing.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function f3dplotpolar (f\$,rmax=1,n=20,scale=1,fscale=1, ..
frame=1,wire=0,xlabel="x",ylabel="y",zlabel="z",maps=0)
```
```  Draw a function defined on the circle with radius rmax.

f3d uses map for the evaluation of the function "f".
n is the spacing.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function f3dplotpolarl (f\$,rmax=1,n=20,scale=1,fscale=1, ..
light=[0,0,1],amb=0.2,max=0.8,frame=1,xlabel="x",ylabel="y",zlabel="z", ..
niveau="auto",hue=1,maps=0)
```
```  Draw a function defined on the circle with radius rmax.

f3d uses map for the evaluation of the function "f".
n is the spacing.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function overwrite fillcolor (c1=11,c2=3)
```
```  Set the fillcolor for the fore- and background of 3D plots.

fillcolor(c1,c2) or fillcolor() returns the colors [c1,c2].

See:   rgb (Basic Plot Functions)
```
```function mark3 (x,y,z)
```
```  Plots points in three dimensions.

x,y,z must be 1xn vectors.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function clipping (flag:integer=true)
```
```  Sets clipping off or on globally for 2D plot functions.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function overwrite plot (x=0, y=0)
```
```  Plots the values (x(i),y(i)) with the current style.
If x is a matrix, y must be a matrix of the same size.
The plot is then drawn for all rows of x and y.
The plot is scaled automatically, unless hold is on.
plot(x,y) and plot() return [x1,x2,y1,y2], where [x1,x2] is the range
of the x-values and [y1,y2] of the y-values.
plot(x) is the same as plot(1:cols(x),x).

To turn off the clipping set defaultclipping=false

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function overwrite mark (x=0,y=0,c=1)
```
```  Plots markers at (x(i),y(i)) according the the actual marker style.
Works like plot.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function cplot (z)
```
```  Plots a grid of complex numbers.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function scalez (z,scale)
```
```  Scale the matrix z to [-scale,scale].

This is a function used by plot3d with parameter scale=1.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function scalez0 (z:real, scale:number, center:integer=1)
```
```  Scale the matrix z to [-scale,scale].

This is a function used by plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function f3d (f,m=40)
```

```function f3dplot (f\$,xmin=-1,xmax=1,ymin=-1,ymax=1,n=40, ..
scale=1,fscale=1,frame=1,wire=0,xlabel="x",ylabel="y",zlabel="z", ..
sliced=0,maps=0,wirecolor=1)
```
```  f3dplot("f") plots a function f(x,y,...) in a square.

f3dplot uses map for the evaluation of the function "f".
"f" may be an expression in x and y.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function f3dplothue (f\$,xmin=-1,xmax=1,ymin=-1,ymax=1,n=40, ..
scale=1,fscale=1,frame=1,xlabel="x",ylabel="y",zlabel="z",niveau=none, ..
maps=0)
```
```  Plots a function f(x,y,...) in a square.

Also f3dplot("f",xmin,xmax,ymin,ymax,n;...).
f3dplot uses map for the evaluation of the function "f".
"f" may be an expression in x and y.

Obsolete. Use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function overwrite density (x,f=0.9,amb=0.1)
```
```  Makes density plot of the values in the matrix x
scaled to fit into [0,f].

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation)
```
```function plot3dbars (x : real vector, y : real vector, z : real, ..
z0 : real scalar)
```
```  Plot bars at x[i],y[j] with height z[i,j].

The bars have limits x[i],x[i+1] and y[j],y[j+1] and use
the values z[i,j]. z must be at least (n-1)x(m-1), if
x is 1xn and y is 1xm. The bars are sorted correctly before
they are plotted by plotcubes.

A comfortable way to use is is via plot3d and bar=true.

See:   plotcubes (Euler Core),   plotcubes (Basic Plot Functions),   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function overwrite plotcubes (M, color=none)
```
```  Plot cubes (parallel to the axes)

See:   plotcubes (Euler Core)
```
```function overwrite insimg (lines:index=25, name:string="", ..
antialias=1, crop=none)
```
```  Insert a file image (PNG) with default size and name. The image
appears in the notebook with the given height in lines. If the name
is not empty, the image will be saved under this name when the
notebook is saved.

antialiased : looks good for most plots, but not for all.

crop : inserts only a top portion of the graphics. The crop can be
a vector [top,bottom,left,right] of numbers from 0 to 1, or it can
be [top,bottom], or only bottom. The defaults are [0,1,0,1].

The crop works well with the aspect function. In fact, if an aspect
is active with larger width than height, only the active portion of
the image is inserted automatically.

See:   insimg (Euler Core),   aspect (Euler Core),   aspect (Basic Plot Functions)
```
```function overwrite insrgb (x:real, lines:integer=25, name:string="")
```
```  Insert an rgb image with default size and name.
The image appears in the notebook with the given height
in lines. If the name is not empty, the image will
be saved under this name when the notebook is saved.

See:   insimg (Euler Core),   insimg (Basic Plot Functions)
```
```function plotrgb (x:real, window:real vector=none)
```
```  Plot an rgb image into the plot window.

The window can be a vector with screen coordinates or none. For
sync with the plot coordinates use getwindowfromplot();

>s=linspace(0,1,100); t=s'; c=rgb(s,t,0);
>setplot(0,1,0,1); plotrgb(c,getwindowfromplot()); xplot():

See:   getwindowfromplot (Basic Plot Functions)
```
```function overwrite loadimg
```
```  loadimg("filename"), loadimg(n,"filename")

Insert an image from file with default maximal size.

The image appears in the notebook with the given height
in lines.

n : maximal number of lines to be used (default is 40)

See:   insimg (Euler Core),   insimg (Basic Plot Functions),   loadimg (Euler Core)
```
```function overwrite loadanaglyph
```
```  loadanaglyph("left","right") or loadanaglyph(n,"left","right")

Loads two images, combines them to one anaglyph, and inserts the
images into the notebook.

n : maximal number of lines to be used (default is 40)

```
```function figure (n:natural, m:index=none)
```
```  figure(nr,nc) divides the graph window into nr rows x nc columns of subplots
figure(n) sets the current drawing window to the nth subplot counting
by rows.
figure(0) sets the plot back to the normal window
```
```function title (text:string)
```
```  Plots a title to the grafik window.

See:   plot2d (Plot Functions plot2d and plot3d),   plot2d (Maxima Documentation),   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function fwebplot (f\$:string, a:real scalar, b: real scalar, ..
xstart: real scalar, n: index, color=9)
```
```  Plots an iteration of fff on [a,b] starting from xstart, n steps
This function can be used to study, demontrate or understand
fixed point iteteration of the type x(n+1) = f(x(n)).

See:   iterate (Numerical Algorithms),   sequence (Numerical Algorithms)
```
```function vectorfield (f\$:string, x1: real scalar, x2: real scalar, ..
y1: real scalar, y2: real scalar, nx:index=20, ny:index=20)
```
```  Draw the vector field of a differential equation in x and y.
expr must be the expression "f(x,y)", which computes the
derivative of y(x) at x.
```
```function vectorfield2 (f1\$:string, f2\$:string, ..
x1: real scalar,x2: real scalar,y1: real scalar,y2: real scalar, ..
nx:index=20, ny:index=20)
```
```  Draw the vector field of a differential equation in x and y.
expr1 and expr2 must be expressions "f(x,y)", which compute the
x- and y-value of the derivative of y(x) at x.
```
```function overwrite view
```
```  view(distance, tele, angle1, angle2) sets the perspective for solid and view.
distance is the eye distance, tele a zooming factor.
angle1 is the angle from the negativ y-axis to the positive x-axis.
angle2 is the angle to the positive z-axis (the height of the eye).
view() returns the current value of view in a vector.
view is used in plot3d as the default view.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation),   zoom (Basic Plot Functions)
```
```function zoom (f:positive=2.5)
```
```  Set the zoom distance to d.

See:   view (Euler Core),   view (Basic Plot Functions),   view (Maxima Documentation)
```
```function viewangle (a:real scalar=0.4)
```
```  Set the view angle to a.

See:   view (Euler Core),   view (Maxima Documentation)
```
```function viewheight (a:real scalar=0.4)
```
```  Set the view height angle to a.

See:   view (Euler Core),   view (Maxima Documentation)
```
```function viewdistance (d:positive=5)
```
```  Set the view distance to d.

See:   view (Euler Core),   view (Maxima Documentation)
```
```function f3daxis (f\$:string, n:index=25)
```
```  Draw a function defined on [-1,1]^2 with x-, y- and z-axis.
f3daxis uses map for the evaluation of the function "f".
2n is the spacing.
Fixed view, cannot be rotated.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function f3daxispolar (f\$:string, n:index=20)
```
```  Draw a function defined on [-1,1]^2 with x-, y- and z-axis.
2n is the spacing.
f3daxispolar uses map for the evaluation of the function "f".
Fixed view, cannot be rotated.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function stereo (f\$:string, a:number=-0.05, s:index=500, ..
d:number=1, parallel:natural=0)
```
```  Stereo plot of the function f from two viewpoints
Calls the function f, which must be the name of
a 3D plot command, and does it twice in two different
windows. Many people are able to view a 3D picture.

There are two ways: parallel view and squint view.
Most people find the latter easier. It is the default
for this function.
```
```function parameterplot (f:string, a:number, d:number, ..
display=1, c=800, r=100, ..
amax=1e30, amin=-1e30)
```
```  Call the plot function f with parameter a adjustable by user.

Animate a paramter with the up/down keys, and show a plot depending
on that parameter. The space key resets the default parameter, and
the return key ends the function.

f : function of a (and additional semicolon parameters)
a : starting value parameter a
d : increment with one keystroke
display : flag for the display of the parameter value
c,r : coordinates for the display
amax,amin : limits for the display

See:   twoparameterplot (Basic Plot Functions)
```
```function twoparameterplot (f\$:string, a:number, b:number, d:number, ..
display=1, c=800, r=100, ..
amax=1e30, amin=-1e30)
```
```  Call the plot function f with parameter a adjustable by user.

Animate a parameter a with the up/down keys, and a parameter b with
left/right keys, and show a plot depending on that parameter. The
space key resets the default parameter, and the return key ends the
function.

f : function of a,b (and additional semicolon parameters)
a : starting value of parameter a
b : second parameter b
d : increment with one keystroke
display : flag for the display of the parameter values
c,r : coordinates for the display
amax,amin : limits for the display

```
```function args makeimpulse (x:real vector,y:real vector,d=0.1)
```
```  Compute {x1,y1} for impulse bar plots.

Computes the correct input for an impulse bar plot
at points x with values y.

x : sorted x parameters
y : values
d : radius of the plot intervals
```

## Functions for Animated Graphics

```function dragpoints (f\$ : string, x : real, y : real,
status="Drag one of the points!")
```
```  Lets the user drag points on a user defined plot.

This function calls a function f(x,y), which draws some plot
depending on the points at coordinates x[i] and y[i]. Then it lets
the user drag one of the points with the mouse.

f : f(x,y[,select]) a plot function. select is the index of the
selected point, if not select==0.

Additional arguments are passed to f.

Returns {x,y}

Example:
>function f(x,y) := plot2d(x,y,>points,a=0,b=1,c=0,d=1);
>{x,y}=dragpoints("f",random(1,10),random(1,10));
```
```function dragvalues (f\$, names, values, ranges, stops=100,
x=0.98, y=0.02, w=0.4, tcolor=red, digits=none,
```
```  Let the user drag parameters for a plot.

This function lets the user drag values for plots. A box with
values appears, by default in the upper right, with an optional
heading. The values can be dragged to the right or left, and change
within given ranges and steps.

f : A plot function depending on a vector of parameters.
names : The names of the parameters for the display.
values : Initial values of the parameters (string vector of length
n or string)
ranges : A nx2 vector of ranges for the values
stops : A vector with the number of subintervals for each range
x,y,w : Position anchored in the top right (fraction of plot window)
tcolor : A vector with colors for the values or one scalar color
digits : A vector of digits for rounding the values or a scalar
hcolor : The color of the heading
status : An optional string for the status line

Example:
>function f([a,b]) := plot2d("a*x^2+b*x";a,b,r=1);
>dragvalues("f",["a","b"],[0,0],[-1,1;-1,1],digits=2, ...
```

The following functions in this section are obsolete, since plot3d can now animate 3D graphics under user control. E.g. plot2d and plot3d have the parameter >user.

```function animate (d:real scalar=0.1)
```
```  Animate pre-defined pages with delay d.

The pages should be generated with calls to addpage, as in the
following example

deletepages();
title("Creating Animation");
showpage(1);
loop ...
... // graph something
end;

See:   rotate (Basic Plot Functions)
```
```function rotate (f\$:string, d:real scalar=0.01, n:integer=120)
```
```  Shows a rotating animation of the plot fff, which must be a 3D plot
command.

Obsolete, since the plot can now be rotated with plot3d under user
control.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function view3d (f\$:string, d:real scalar=0.1)
```
```  Calls the plot f\$, which must be a 3D plot command, waits for key
strokes to rotate it.

Use the cursor keys for rotation, del and backspace, or space, to

Obsolete, use plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function fanimate (f\$:string, t:vector, d:real scalar=0.01)
```
```  Animate the function f\$

fff should display some graphics depending on t. Additional
parameters are passed to f.

```

Most of the following functions need never be used, since 3D graphics should be done with plot3d.

```function getframe (x,y,z)
```
```  Gets a box around all points in (x,y,z).

Returns [xmin,xmax,ymin,ymax,zmin,zmax]
```
```function framedplot (f\$:string, frame:real vector,
sframe:real vector=none,
xl:string="x", yl:string="y", zl:string="z",
ticks:integer=1,
view=none, zoom=none, distance=none, angle=none, height=none,
center=none)
```
```  General function for framed plots.

This function does the same as the functions called by plot3d. It
draws a frame around a plot. The frame is drawn in two parts, one
in the back and one in the front. It can display ticks, which may
have nothing to do with the frame itself (sframe parameter).

A function using this function can be used in plot3d with parameter
>own to allow anaglyphs or turning.

f : A 3D plot function. This can also be plot3d with parameter
<frame. Semicolon parameters are passed to f.

frame : The frame. take care that the plot fits into the frame. The
frame is a vector of the form [xmin,xmax,ymin,ymax,zmin,zmax]

sframe : The tick values for the frame. If sframe=none then frame
is used.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function framedsolid (x:real, y:real, z:real,
scale:real vector=1, fr:integer=1, hf:number=1,
disconnect=none,
xlabel:string="x", ylabel:string="y", zlabel:string="z",
sliced:integer=0, bar:integer=0, z0:real=0,
frame:real vector=none, sframe:real vector=none)
```
```  3D plot with frame.

x, y, and z must be compatible matrices. The determine the
coordinates of the 3D images of a parameter matrix.

If scale is specified, then the plot is scaled to fit into a cube
of side length 2*scale centered at 0.

If fr=0 then no frame will be drawn around the plot.

disconnect is a vector of indices containing the rows of the
matrix, which should not be connected.

sliced is a parameter, which produces sliced plots into the x, or
the y direction. Should only be used for regular x,y grids.

bar is a parameter, which makes the plot into steps. Should only be
used for regular x,y grids.

This function should only be used via plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function framedsolidhue (x:real, y:real, z:real, hue, ..
scale:real vector=1, f:number=1, fr:integer=1, hf:number=1, ..
xlabel:string="x", ylabel:string="y", zlabel:string="z", ..
niveau=none, values=none, ..
light=[0.5,0.5,1], amb=0.1, max=0.9, huecolor=0, ..
contourcolor=8, contourwidth=1, z0=0,
frame=none, sframe=none,
dl=none, limits=none)
```
```  3D plot with hue, and optional niveau lines.

x, y, and z must be compatible matrices. They determine the
coordinates of the 3D images of a parameter matrix. hue is an
the matrix at each point. E.g., plot3d computes the hue using a
light source.

niveau is a row vector of niveaus levels, which are to be drawn.
values is a matrix of the same size as x, y, and z which contains
the values, which determine the niveau. By default, the value will
be z.

If scale is specified, then the plot is scaled to fit into a cube
of side length 2*scale centered at 0.

If fr=0 then no frame will be drawn around the plot.

disconnect is a vector of indices containing the rows of the
matrix, which should not be connected.

This function should only be used via plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation)
```
```function framedwire (x:real, y:real, z:real,
scale:real vector=1, fr:integer=1, hf:number=1,
xlabel:string="x", ylabel:string="y", zlabel:string="z",
wirecolor:number=1, rowsonly:integer=0, z0:real=0,
frame:real vector=none, sframe:real vector=none)
```
```  3D wire plot with frame.

x, y, and z must be compatible matrices. They determine the
coordinates of the 3D images of a parameter matrix.

If scale is specified, then the plot is scaled to fit into a cube
of side length 2*scale centered at 0.

If fr=0 then no frame will be drawn around the plot.

With rowsonly=1 the wire will be drawn only in one direction.

The wirecolor can be specified with the variable wirecolor. Use any
of the 16 predefined colors, or an rgb value.

This function should only be used via plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation),   rgb (Basic Plot Functions)
```
```function framedmark3 (x:real, y:real, z:real,
scale:real vector=1, fr:integer=1, hf:number=1,
xlabel:string="x", ylabel:string="y", zlabel:string="z",
color=1, z0:number=0,
frame:real vector=none, sframe:real vector=none)
```
```  3D point plot with frame.

x, y, and z must be row vectors. They determine the coordinates of
the 3D images of the points.

This function should only be used via plot3d.

See:   plot3d (Plot Functions plot2d and plot3d),   plot3d (Maxima Documentation),   rgb (Basic Plot Functions)
```
```function overwrite subgrid (v)
```

Documentation Homepage