﻿ Euler Math Toolbox - Reference

# Plot Functions

## Content

The plot functions of EMT.

## Reset

```white:=0;
black:=1;
red:=2;
green:=3;
blue:=4;
cyan:=5;
olive:=6;
lightgray:=7;
gray:=8;
darkgray:=9;
orange:=10;
```
```turquoise:=12;
lightblue:=13;
lightorange:=14;
yellow:=15;
```
```ResetEpsilon:=epsilon();
ResetView:=_view();
```
```function reset
```
```  Resets many internal settings.

This function resets the default settings for colors, line width,
the default view, and other basic settings for Euler graphics. It
does also unclip the window, and release the hold flag.

Moreover, the function resets the default format to long, and
restores the default epsilon.

See:   restart (Euler Core),   restart (Maxima Documentation)
```

## Plots in 2D

plot2d() handles all plotting in the plane. This includes plots of functions of one variable, implicit plots of functions of two variables, plots of curves and polygons in the plane, data and bar plots of two vectors, or clouds of points in the plane.

plot3d() handles all plotting in 3D stereographic view. This includes plots of functions of two variables, implicit plots of functions of three variables, plots of surfaces, bar plots of matrices, or clouds of points in the space. There is an option to view the plot in anaglyph mode with red/cyan glasses.

For a demonstration of 2D plots in Euler, see the following introduction notebook.

```function plot2d (xv,yv=none,btest=none,
a=none,b=2,c=none,d=2,
xmin=none, xmax=1, r=none, n=none, logplot=0,
grid=none, frame=none, framecolor=none,
square=0, color=none, thickness=1, style=none, auto=1, add=0,
bar=0, histogram=0, distribution=0, even=0, steps=0,
hue=0, level=none, contour=0, nc=defaultnc,
filled=0, fillcolor=none, outline=1,
title="",xl=none,yl=none,
maps=0,
contourcolor=none, contourwidth=1,
ticks=1, margin=none, clipping=true,
cx=0, cy=0,
insimg=0, spectral=0,
cgrid=none, vertical=1, smaller=none,
dl=0,
niveau=none, levels=none)
```
```  Multipurpose plot function for plots in the plane.

Multi-Purpose function for 2D plots. For an overview of Graphics
and Plots in EMT, double click the following link.

See:   Plots (Overview)

This function can do plots of functions of one variables, data
plots, curves in the plane, bar plots, grids of complex numbers, and
implicit plots of functions of two variables.

Typical Examples:

>plot2d("x^3-x",-1,2,title="y=x^3-x",yl="y",xl="x");
>plot2d("x^3-x",a=0,b=2,c=-1,d=2,grid=3,<frame);
>plot2d({{"x^3-a*x",a=1}},>user,title="Press any key!");

>function f(x) &= x^x;
>plot2d(f,r=1,cx=1,cy=1,color=blue,thickness=2);

>x=linspace(0,2pi,1000);
>plot2d(sin(5x),cos(7x));
>plot2d(sin(x),cos(x)*0.5,r=1,>filled,style="/");

>k=0:10;
>plot2d(k,bin(10,k),>bar);

>plot2d(normal(1,1000),>distribution,style="O");
>plot2d("qnormal",0,5;2.5,0.5,>filled);

>plot2d("x^2",0,1,steps=1,color=red,n=10);

>plot2d("x^3-y^2",>contour,>hue,>spectral);

Parameters

x,y : equations, functions or data vectors

a,b,c,d : Plot area (default a=-2,b=2)
r : if r is set, then a=cx-r, b=cx+r, c=cy-r, d=cy+r
r can be a vector [rx,ry] or a vector [rx1,rx2,ry1,ry2].
xmin,xmax : range of the parameter for curves
auto : Determine y-range automatically (default)
square : if true, try to keep square x-y-ranges
n : number of intervals (default is adaptive)
grid : 0 = no grid and labels,
1 = axis only,
2 = normal grid (see below for the number of grid lines)
3 = inside axis
4 = no grid
5 = full grid including margin
6 = ticks at the frame
7 = axis only
8 = axis only, sub-ticks
frame: 0 = no frame
framecolor: color of the frame and the grid
margin : number between 0 and 0.4 for the margin around the plot

color :
Color of curves. If this is a vector of colors,
it will be used for each row of a matrix of plots. In the case of
point plots, it should be a column vector. If a row vector or a
full matrix of colors is used for point plots, it will be used for
each data point.

thickness : line thickness for curves
This value can be smaller than 1 for very thin lines.

style :
Plot style for lines, markers, and fills.
For points use
"[]", "<>", ".", "..", "...",
"*", "+", "|", "-", "o"
"[]#", "<>#", "o#" (filled shapes)
"[]w", "<>w", "ow" (non-transparent)
For lines use
"-", "--", "-.", ".", ".-.", "-.-", "->"
For filled polygons or bar plots use
"#", "#O", "O", "/", "\", "\/",
"+", "|", "-", "t"

points : plot single points instead of line segments
addpoints : if true, plots line segments and points

user : enable user interaction for functions
delta : step size for user interaction

bar : bar plot (x are the interval bounds, y the interval values)
histogram : plots the frequencies of x in n subintervals
distribution=n : plots the distribution of x with n subintervals
even : use inter values for automatic histograms.

steps : plots the function as a step function (steps=1,2)
adaptive : use adaptive plots (n is the minimal number of steps)

level : plot level lines of an implicit function of two variables
outline : draws boundary of level ranges.

If the level value is a 2xn matrix, ranges of levels will be drawn
in the color using the given fill style. If outline is true, it
will be drawn in the contour color. Using this feature, regions of
f(x,y) between limits can be marked.

hue : add hue color to the level plot to indicate the function
value
contour : Use level plot with automatic levels
nc : number of automatic level lines

title : plot title (default "")
xl, yl : labels for the x- and y-axis
smaller : if >0, there will be more space to the left for labels.

vertical :
Turns vertical labels on or off. This changes the global variable
verticallabels locally for one plot. The value 1 sets only vertical
text, the value 2 uses vertical numerical labels on the y axis.

filled : fill the plot of a curve
fillcolor : fill color for bar and filled curves
outline : boundary for filled polygons

logplot : set logarithmic plots
1 = logplot in y,
2 = logplot in xy,
3 = logplot in x

own :
A string, which points to an own plot routine. With >user, you get
the same user interaction as in plot2d. The range will be set
before each call to your function.

maps : map expressions (0 is faster), functions are always mapped.

contourcolor : color of contour lines
contourwidth : width of contour lines

clipping : toggles the clipping (default is true)

title :
This can be used to describe the plot. The title will appear above
the plot. Moreover, a label for the x and y axis can be added with
xl="string" or yl="string". Other labels can be added with the
functions label() or labelbox(). The title can be a unicode
string or an image of a Latex formula.

cgrid :
Determines the number of grid lines for plots of complex grids.
Should be a divisor of the the matrix size minus 1 (number of
subintervals). cgrid can be a vector [cx,cy].

Overview

The function can plot

- expressions, call collections or functions of one variable,
- parametric curves,
- x data against y data,
- implicit functions,
- bar plots,
- complex grids,
- polygons.

If a function or expression for xv is given, plot2d() will compute
values in the given range using the function or expression. The
expression must be an expression in the variable x. The range must
be defined in the parameters a and b unless the default range
[-2,2] should be used. The y-range will be computed automatically,
unless c and d are specified, or a radius r, which yields the range
[-r,r] for x and y. For plots of functions, plot2d will use an
adaptive evaluation of the function by default. To speed up the
plot for complicated functions, switch this off with <adaptive, and
optionally decrease the number of intervals n. Moreover, plot2d()
will by default use mapping. I.e., it will compute the plot element
vector x, you can switch that off with <maps for faster evaluation.
Note that adaptive plots are always computed element for element.

The parameter >user allows the user to zoom and shift the plot with
the cursor keys or the mouse.

>plot2d("x^3-x",-1,2);
>plot2d("x^x",r=1,cx=1,cy=1);
>plot2d("sin(x)*exp(-x)",>user);

If functions or expressions for both xv and for yv are specified,
plot2d() will compute a curve with the xv values as x-coordinates
and the yv values as y-coordinates. In this case, a range should be
defined for the parameter using xmin, xmax. Expressions contained
in strings must always be expressions in the parameter variable x.

>plot2d("cos(x)","sin(3*x)",xmin=0,xmax=2pi);
>plot2d("cos(x)","sin(x)^3",xmin=0,xmax=2pi,>filled,style="/");

If xv and yv are data vectors, these data will be used as x- and
y-coordinates of a curve. In this case, a, b, c, and d, or a radius
r can be specified, or the plot window will adjust automatically to
the data. Alternatively, >square can be set to keep a square
aspect ratio.

>t=linspace(0,1,1000); r=exp(-t); x=r*cos(2pi*t); y=r*sin(2pi*t);
>plot2d(x,y,r=1):

To plot sets of points use >points. Then xv and yv can be vectors
of coordinates. If the color is a vector of colors, each points
gets a different color. For a matrix of coordinates and a column
vector, the color applies to the rows of the matrix. The parameter

>plot2d(normal(1000),normal(1000),>points,grid=6,style="..");

The function plot2d() can also plot curves or data as filled
polygons with >filled. The fill color is determined by
the argument "fillcolor", and on optional <outline prevents
drawing the boundary for all styles but the default one.

>t=linspace(0,2pi,6); plot2d(cos(t),sin(t),>filled,style="|");

If xv is a sorted vector, and yv is a vector of intervals, then
plot2d will plot the filled ranges of the intervals in the plane.
The fill styles are the same as the styles of polygons.

>t=-1:0.01:1; x=~t-0.01,t+0.01~; y=x^3-x;
>plot2d(t,y):

Implicit plots show level lines solving f(x,y)=level, where
"level" can be a single value or a vector of values. If
level="auto", there will be nc level lines, which will spread
between the minimum and the maximum of the function evenly. Darker
or lighter color can be added with >hue to indicate value of the
function. For implicit functions, xv must be a function or an
expression of the parameters x and y, or, alternatively, xv can be
a matrix of values.

>plot2d("x^2+y^3+x*y",level=1,r=4,n=100);
>plot2d("x^2+2*y^2-x*y",level=0:0.1:10,n=100,contourcolor=white,>hue);

Implicit plots can also show ranges of levels. Then level must be a
2xn matrix of level intervals, where the first row contains the
start and the second row the end of each interval. Alternatively, a
simple row vector can be used for level, and a parameter dl extends
the level values to intervals.

>plot2d("x^2+y^3+x*y",level=[0,2,4;1,3,5],style="/",r=2,n=100);
>plot2d("x^2+y^3+x*y",level=-10:20,r=2,style="-",dl=0.1,n=100);

The data for bar plots (bar=1) and histograms (histogram=1) can
either be explicitly given in xv and yv, or can be computed from
an empirical distribution in xv with >distribution (or
distribution=n). Histograms of xv values will be computed
automatically with >histogram. If >even is specified, the xv values
will be counted in integer intervals.

>plot2d(normal(10000),distribution=50);
>k=0:10; m=bin(10,k); x=(0:11)-0.5; plot2d(x,m,>bar);
>columnsplot(m,k);
>plot2d(random(600)*6,histogram=6);

Logarithmic plots can be plotted either using a logarithmic scale
in y with logplot=1, or using logarithmic scales in x and y with
logplot=2, or in x with logplot=3.

>plot2d("exp(x^3-x)*x^2",1,5,logplot=1);

If you wish to show more than one function in a single plot use
several calls to plot2d, and >add in all, but the first call, or
provide a vector of expressions and functions, or use a matrix of
yv values, with one function in each row.

>plot2d(["exp(x)","1+x"],color=[black,blue],style=["-","-.-"]);
>x=0:0.01:1; n=(0:10)'; plot2d(x,x^n,color=2:12);

If xv is a function or an expression, >user allows the user to
zoom (+/-), set the plot window with the mouse, or move the
plot (cursor keys). The space key will reset the plot to the
original plot window. If xv is a data, then >user will simply
wait for key stroke.

An array of complex numbers can also be plotted. Then the grid
points will be connected. If a number of grid lines is specified
(or a 1x2 vector of grid lines) in the argument cgrid only those
grid lines are visible.

>r=linspace(0,1,50); a=linspace(0,2pi,200)'; z=r*exp(I*a);
>plot2d(exp(z),cgrid=[40,10]):
>r=linspace(0,1,10); a=linspace(0,2pi,40)'; z=r*exp(I*a);

See:   plot3d (Plot Functions),   plot3d (Maxima Documentation),   label (Plot Functions),   label (Maxima Documentation),   rgb (Plot Functions),   yaxis (Plot Functions),   yaxis (Maxima Documentation),   xgrid (Plot Functions),   xlabel (Plot Functions),   xlabel (Maxima Documentation),   call (Euler Core)
```

## Plots in 3D

```function plot3d (x, y=none, z=none,
xmin=none, xmax=none, ymin=-1, ymax=1, n=60,
a=none, b=none, c=none, d=none, r=none,
scale=1, fscale=-1, frame=1,
angle=none, height=none, zoom=none,
distance=none, view=none,
center=none, cx=0, cy=0, cz=0,
xlabel="x", ylabel="y", zlabel="z",
sframe=none, grid=none,
polar=false, sliced=false, disconnect=none,
hue=false, light=[2,3,4], amb=0.1, max=0.9,
spectral=false, xhue=0, yhue=0, zhue=0, hues=none,
color=none, framecolor=none, transparent=0,
anaglyph=0,	user=0, duser=0.1,
wire=false, wirecolor=none, points=false, style=".",
lines=false, contour=false, rotate=false, title="",
bar=false, own=false,
level=none, dl=0, nc=defaultnc, values=none, contourcolor=none, contourwidth=1,
implicit=false, zmin=-1, zmax=1,
maps=false, insimg=false,
cp=false, cpcolor=none, cplevel=none, cpdelta=0.05,
levels=none, niveau=none,
linewidth=none, fillcolor=none,
fullwindow=true,
zscale=false)
```
```  General function for 3D plots.

Multi-Purpose function for 3D plots. For an overview of Graphics
and Plots in EMT, double click the following link.

See:   Plots (Overview)

This function can plot 3D plots with graphs of functions of two
variables, parameterized surfaces, space curves, clouds of points,
solutions of an equation of three variables. All 3D plots can be
shown as anaglyphs.

Typical Examples:

>plot3d("x*y",r=1,title="z=x*y"):
>plot3d("x*y^2",>user,r=1,title="Press cursor keys or return!"):
>plot3d("x^2*y^3",r=0.9,zlabel="x^2*y^3",angle=30°,height=20°,zoom=3, ...
>  >cp,cplevel="thin",cpcolor=green):
>plot3d("x^2+y^3",angle=0°,>contour,>spectral):
>plot3d("x^y-y^x",a=0,b=4,c=0,d=4,angle=40°,level=0, ...
>  contourwidth=4,contourcolor=red,n=100):
>plot3d("x^2+y^2",>wire,>anaglyph,title="Use Red/Cyan Glasses!",n=10):
>plot3d("x^3+y^2",0,2,0,10,scale=[5,1,2],zoom=3.2,grid=10,>transparent):
>plot3d("x^2+y^3+sin(z)^2-1",r=pi,implicit=4,zoom=3):
>x=-1:0.05:1; y=x'; plot3d(x,x*y^2,y,>hue,angle=20°):
>h=x^2+y^2; ...
>plot3d(x,y,(y-x)/2,level=-2:0.1:2,values=h,hues=h/2,>spectral):
>X=normal(3,1000); plot3d(X,X,X,>points,zoom=3,>user):
>Y=cumsum(X); plot3d(Y,Y,Y,>wire,>user):
>t=linspace(0,2,1000);  ...
>plot3d(sin(2pi*t),cos(2pi*t),t,>wire,>anaglyph):

Parameters

x : expression in x and y
x,y,z : matrices of the coordinates of a surface
x,y,z : expressions in x and y for a parametric surface
x,y,z : expressions in x to plot a curve
xmin,xmax,ymin,ymax : bounds for plots over rectangles
a,b,c,d : alternative for xmin,xmax,ymin,ymax
r can be a vector [rx,ry] or [rx,ry,rz]
cx, cy, cr : center of plot, if r is used
r : also used for polar plots

n : Accuracy, i.e. the number of sub-intervals.
grid : Number of grid lines.

Remarks on n and grid :
The parameters n and grid can be 1x2 vectors for plots depending
on x and y, and 1x3 vectors for implicit plots depending on x, y
and z. If grid is set it must be an integer number. If it is larger
than 0, grid+1 grid lines will be drawn. n is still the total
number of sub-intervals, but it will be adjusted to be a multiple
of the number grid intervals. For data plots, grid will be set to
the number of data points by default.

scale : scale plot to this size (0 = no scaling, 1 = default)
if scale is a 1x3 vector, it will scale in each direction
fscale : scales the z-values for a function to this range (0=no,
-1=auto)
zscale : scales data matrices in z-direction. Can be combined with
scale=[sx,sy,sz]. The value of zscale is used as a scaling
factor. It should be between 0.1 and 1.

wire : wire plot
polar : polar plot
points : cloud of points

sliced : plot a sliced version (0=no, 1=x-direction, 2=y-direction)
light, amb, max : controls the shading
contour : show thick level lines (automatic levels)
levels: if true, set thin level lines (automatic levels)
level : level lines (1xn vector) or level ranges (2xn vector)
dl : make level lines to level ranges with this thickness

spectral : use spectral colors instead of monochrome hue
There are spectral schemes from spectral=1 (or >spectral)
to spectral=9. In fact, this is equivalent to color=-2 to color=-10.

xhue,yhue,zhue : use these coordinates instead of default lighting
hues : a matrix of hue values from 0 to 1

values : values to be used for contour plots (default: z-values)
contourcolor : color of contour lines
contourwidth : width of contour lines

limit : clip the area exceeding these values.

user : user can turn the plot around with the keyboard
duser : controls the user action

lines : a line given by three expressions
rotate : rotation plot, the function must be of one variable

anaglyph : 3d plot

viewangle : changes the default angle of view
viewheight : changes the height of view
zoom : changes the zoom of view
distance : changes the distance of view
view : sets the default view

implicit : for implict plots of f(x,y,z)
0=off, 1=x, 2=y, 4=z, can be combined by adding

style : plot style for markers (see plot2d for available styles)

maps : expressions should be mapped (faster, if 0), functions
are always mapped.

color : color for markers and for shaded surfaces
wirecolor : color for wire plots

frame : If 0, no frame is drawn. If this is a vector, it must be of
the form [xmin,xmax,ymin,ymax,zmin,zmax] and will be used as a
frame for plots. The plot must fit into the frame then.
framecolor : color of the 3D frame

sframe : Sets the tick values for the axes. This is a vector of the
same form as frame.

cp : if true, draws a contour plane below the plot
cpcolor : the color for the contour plane
cplevel : the level lines for the contour plane
cpdelta : the distance (relative) to the z-range

Some settings are global

fillcolor(11,3) : fill color for 3d surfaces (no hue).
twosides(1) : show two different colors for each side.

Overview

This function can plot

- the graph of a function in two variables,
- as a wire plot,
- a solid plot,
- or with level lines.
- surfaces, described by three matrices of x-, y-, and
z-coordinates, or by three functions of two parameters.
- curves in space,
- a cloud of points,
- implicit functions of 3 variables,
- anaglyphs.

The plot3d function uses the convention, that the x axis goes to
the right, the y axis points into the screen, and the z axis goes
vertically upwards. With these orientations, it plots in central
projection. The plot can be turned to the left and right around the
z axis, and up and down. The point that the user looks at is the
origin (0,0,0) by default. The default position of the eye is in
the positive quadrant x,y>0, at a medium height above the x-y
plane. The default plot style is a grid with two sides in different
colors, which are globally determined by fillcolor().

>plot3d("-x*y^2"):
>plot3d("x^2+y^4",grid=20,fillcolor=[gray,rgb(0.6,0.6,0.6)]):

The direction of the view and the zoom can be set with the
arguments angle, height, zoom and distance. Plots can be
interactive with >user. In this case the user can turn the plot
with the cursor keys, and zoom the plot with +/-. The current
values of the angles and zoom are visible in the status line. The
space key will reset the default view. For solid plots with light,
the key l will toggle to the movement of the light. The center of
the plot can also be moved in four directions. You can toggle the
movement of the plot center with the key c.

>plot3d("x^2+y^2",angle=0°,height=70°,distance=6,zoom=4):
>plot3d("x^2+y^2",>user):

To plot a function of x and y, use an expression string, a call
collection (such as {{"a*x*y",a=4}}) or a function name for the
first parameter. "plot3d" will evaluate the function on a grid of
x and y values, and plot the graph of the function. The parameter n
determines the number of grid lines in both directions (or in each
direction if it is a 1x2 vector). The function values will be
scaled in z direction, but not in x or y direction. By default
(fscale=-1), the scaling will depend on the x and y range to make
the graph look good. But an own scaling factor can be used by
setting fscale to some positive value. All 3D plots can be scaled
in all directions with the parameter scale. Instead of rectangle
coordinates, polar coordinates can be used with >polar.

>plot3d("exp(-x)*sin(y)",0,2,0,2pi,scale=[3,6/(2pi),2]):
>plot3d("x^2+y^2",>polar,fscale=0.5):

To plot a surface from data, plot3d needs the x, y and z
coordinates of the surface. These coordinates must be stored in
three matrices. So the parameterization of the surface is always
rectangular. Note, that three matrices with compatible size must be
provided, one for each coordinate of the surface. Row and column
vectors will be expanded using the rules of the matrix language.

>x=-1:0.05:1; y=x'; z=x*y; plot3d(x-y,x+y,z,grid=10);
>a=linspace(-pi/2,pi/2,90); b=linspace(0,2pi,180)'; ...
>plot3d(cos(a)*cos(b),cos(a)*sin(b),sin(a),grid=18):

If three function names, or three expressions of the variables x
and y are provided then plot3d will compute the coordinates of
the surface using the ranges [xmin,xmax] for x or [ymin,ymax] for y.
Again, n will be the number of partitions.

>plot3d("x*y^2","x-y","x+y",xmin=-1,xmax=1,ymin=-1,ymax=1,grid=10):

computed assuming a light from a given direction, and ambient light
of a given brightness. Its color can be changed, e.g. with
color=red. There is also a transparent color and a spectral color
which can be set with with >spectral (or color=redgreen,
yellowblue, purplegreen, blueyellow, greenred, blueyellow,
greenpurple, yellowblue). In case of a spectral shading use >zhue
for a hue depending on the z-values and >xhue, >yhue respectively
instead of >hue. In case of a surface plot with coordinate
matrices, it is possible to add a matrix of hue values between 0
and 1.

>plot3d("x^2+y^2",>hue,grid=10,color=green,wirecolor=black);
>plot3d("x^2+y^2",>hue,grid=10,color=transparent):
>plot3d("x^2+y^2",>zhue,grid=10,color=redgreen):
>x=-1:0.01:1; y=x'; ...
>plot3d(x,y,x^2+y^2,hues=scalematrix(x+y),>spectral,grid=10):

Level lines at specific levels can be added with level=v, where v
is a vector of level values. The color of the contour lines can be
set with contourcolor=color. The values for the level lines refer
to the z value of the surface. But if a matrix of values is
provided with values=w, then these values will be used to plot the
contour lines at the specific levels. This form of level lines will
work only for surfaces given by data and if level=v is provided.

>plot3d("y^2-x^3",level=-2:0.1:2,color=gray,contourcolor=red,n=100):
>x=-1:0.01:1; y=x'; ...
>plot3d(x,y,y^2-x^3/4,level=-3:0.1:3,>spectral,values=(1-x^2)+y^2):

Levels can also be ranges of levels in a 2xn matrix. The first row
are the lower, the second the upper bounds of the ranges. The area
between the ranges is plotted in the contour color. In fact, the
argument >contour, a value for dl or level="thick" automatically
produces ranges. Instead a vector, level lines can be expanded with
a parameter dl for a matrix of level ranges.

>plot3d("x^2+y^2",>contour,n=100):
>plot3d("x*y",level=-2:0.1:2,dl=0.01,contourcolor=red,n=100,angle=20°):
>plot3d("x*y",level=[-2;0],contourcolor=red,n=100,angle=20°):

Below each graph of a function a contour plane can be added with
>cp. By default it has the same style as the plot, unless the plot
is a simple grid plot. But the style can be set to other styles
with cp=2 or cp=3. Moreover, there are the parameters cpdelta,
cpcolor, cplevel.

>plot3d("x^2+y^2",>spectral,grid=10,>n=100, ...
>  >cp,cpdelta=0.2,cplevel="thin"):

To plot a cloud of points, use three vectors of x-, y- and
z-coordinates, and set points=1. You can set the point style with
style, which must be one of "[]", "<>", ".", "..", "*", "+", or
"o". For a big lot of points, it looks good to use ".", and
optionally view the cloud in anaglyph mode (>anaglyph). For a point
cloud with points in different colors, the color parameter can be a
row vector of colors. In this case, the points in the back are
drawn before the points in the front.

>X=random(3,10000); x=X; y=X; z=X; c=1-(x+y)/2; ...
>plot3d(x,y,z,>points,color=rgb(c,c,1-c),style=".."):

A surface can also be drawn as a wire frame plot with >wire. To
plot one curve or several curves in 3D, either provide three
vectors of data containing the x-, y- and z-parameters of the
curve, or three functions or expressions in the variable x, and set
>lines. In the case of three functions, the range [xmin,xmax] is
used. To plot several curves at once, use three matrices, with one
row for each curve, and specify lines=1.

>phi=linspace(0,2,1000);  ...
>x=cos(2pi*phi); y=sin(2pi*phi); z=phi; ...
>x1=cos(2pi*phi+pi); y1=sin(2pi*phi+pi); ...
>plot3d(x_x1,y_y1,z,>lines):

Functions of one variable rotated around the x axis can be plotted
with rotate=1. In this case, plot3d needs an expression in x, or a
function f(x), and the range is [xmin,xmax]. The function can also
be rotated around the z axis (rotate=2). In this case use a
non-negative xmin.

>function f(x) := x^2+1
>plot3d("f",rotate=1,scale=[2,1,1],grid=10):

Implicit plots show the solutions of f(x,y,z)=0 with implicit=1.
The function needs an expression in x, y, and z, or the name of a
function f. Cuts trough this set orthogonal to an axis will be
drawn. Use 1 for the x-axis, 2 for the y-axis and 4 for the z-axis.
Implicit plots are the slowest of the 3D plots. You can speed up
the plot using expressions, which can handle matrices, with
maps=0. The color and width of the lines can be set.

>plot3d("x^2+y^2+z^2-1",r=1.2,>implicit, ...
>  contourcolor=green,contourwidth=0.5);

All plots can be anaglyphs. Use red/cyan glasses to see the rather
nice 3D effect. Either enter the parameter analgyph=1, or press a
in interactive plots.

>plot3d("x^2+y^2+z^2-1",r=1.2,>implicit,wirecolor=red,>anaglyph):

EMT does not have a true 3D scene. If you want to add more than one
object to a 3D plot, you need to plot the object further away
at first. The parameter >add can be used to hold the scene for the
second plot. If such plots should be interactive or anaglyphs, a
plot function together with the >own parameter must be used.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation),   call (Euler Core)
```

## 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 squarewindow ()
```
```  Make the plot window square.

This function is called by fullwindow() and shrinkwindow() with the
>square parameter. It makes the window square in screen coordinates
by retracting its larger dimension towards the middle of the
window.

See:   fullwindow (Plot Functions),   shrinkwindow (Plot Functions)
```
```function fullwindow (title=false, square=true)
```
```  Takes the full size for the plots

The plot window is the part that is actually used by plot2d and
plot3d for graphs. For plot2d() it does not include the labels, the

See:   allwindow (Plot Functions),   shrinkwindow (Plot Functions),   reset (Plot Functions),   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 (Plot Functions),   reset (Plot Functions),   reset (Maxima Documentation)
```
```function allwindow
```
```  Takes all of the window for the plot

See:   fullwindow (Plot Functions),   shrinkwindow (Plot Functions)
```
```function overwrite setplot
```
```  setplot(xmin xmax ymin ymax) sets the plot coordinates.

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 (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. The function can also be used
with a 1x4 vector. It returns a 1x4 vector. Calls the built-in
function _clip().

See:   unclip (Plot Functions)
```
```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 to screen coordinates

Plot coordinates are generated by the last plot or by setplot().
They reflect the x-y-positions of the points in the plot. Screen
coordinates range from 0..1024 (even for non-quadratic aspect
rations).

The function calls the built-in function _toscreen([x,y]), which
accepts and returns 1x2 vectors. With only one parameter, the
function calls _toscreen() directly assuming a 1x2 vector. With two
parameters, it assumes x and y separately, and returns {c,r}.

See:   aspect (Euler Core),   aspect (Plot Functions),   setplot (Euler Core),   setplot (Plot Functions)
```
```function overwrite args fromscreen (c,r=none)
```
```  Convert the screen coordinates v,v to x-y-coordinates.

fromscreen(c,r) : column and row in screen coordinates,
returns {x,y}
[c,r] : use function with vectors, returns [x,y]

Calls the built-in function _fromscreen(). For more explanation
about coordinates see the function toscreen().

See:   toscreen (Plot Functions)
```
```function label (text, x:number, y:number, offset=15, ..
color=none, ypos="l", xpos="r", pos=none,
scale=1/3, tcolor=0)
```
```  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. The label can be simple
text or an RGB matrix, e.g. parsed from a Latex formula.

text : String, vector of strings or RGB matrix.
A vector of strings is line by line. To get an RGB matrix of
color values from a Latex formula, use latex(expr).

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("f",r=2); ...
>label("Min",1/sqrt(3),f(1/sqrt(3)),pos="lc"); ...
>label("Max",-1/sqrt(3),f(-1/sqrt(3)),pos="uc"); ...
>label(latex("y=x^3-x",factor=2),-1,1,pos="ur"):

See:   labelbox (Plot Functions),   latex (Plot Functions)
```
```function labelbox (labels, styles="-", colors:real=1,
x=0.98, y=0.02, style="O#", color=0,
w=none, points=0, tcolor=none, left=0, wt=0.3,
latex=0, scale=1, latexwidth=5)
```
```  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.
color : background color
style : background style
left : align at the top left corner (default is top right)
wt : fraction of the width for the text
latex : parse each label through Latex and plot the formulas
scale : take higher lines than the normal text height
latexwidth : We assume that Latex formulas are 5 characters wide

For a transparent box set style="t" and color=black for a black
boundary. Set color=transparant for no boundary.

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

See:   label (Maxima Documentation)
```
```function textbox (s, x=0.98, y=0.02,
style="O#", color=0, tcolor=none, w:real=none,
left=0, spaces=2, scale=1/3, center=false)
```
```  Plot a box with text.

x,y :
An anchor for the upper left corner of the box (fractions of plot
area)

s : A string or a vector of strings, one for each line of text
tcolor : Color or an array of colors for the text lines
w : an optional width of the box (fraction of plot area)
left : align at the left edge (default is right edge)
center : center text in its box

For styles and colors see labelbox().

>function f(x) &= x^3-x; ...
>plot2d(f,r=2); ...
>textbox(latex(&f(x),factor=2,color=green),0.4,0.2):

See:   label (Plot Functions),   label (Maxima Documentation),   labelbox (Plot Functions)
```
```function plotbar1 (x:number,y:number,w:number,h:number)
```
```  Plots a single bar rectangle with x,y,w,h in plot coordinates.

Use barstyle() and barcolor() to modify the bar.

See:   bar (Euler Core)
```
```function plotbar (x,y,w,h,color=none,st=none)
```
```  Plots bars with x,y,w,h in plot coordinates.

The parameters can be vectors.

x,y : lower left coordinate
w,h : width and height
color : color of bars
style : style of bars

See:   bar (Euler Core)
```
```function barclear ([x,y,w,h],color=0,style="O")
```
```  Clear a region in screen coordinates

This can also be used to draw rectangles with specific style and
color. The styles and colors will be reset after the plot.

See:   bar (Euler Core)
```
```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 (Maxima Documentation)
```
```function xplotrange (r:real vector, v:real vector)
```
```  Plots a bar plot 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 (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. The function returns vectors
{x,y} of the clicked coordinates.

See:   mouse (Euler Core)
```

## Plotting Text

```function textheight
```
```  Height of a letter.
```
```function textwidth
```
```  Width of a letter.
```
```function ticks (a=0, b=none, finer=false, vertical=false, n=none)
```
```  Ticks to be used for intervals [a,b].

This function is used to compute the ticks for plots. It tries to
show ticks of major decimal values, but not too many or too few.
The target number of ticks is 5, but for small windows this
number is reduced.

a,b : Plot range
finer : compute for the fine grid in grid=8
vertical : compute grid for vertical plots (respect aspect ratio)
n : target number of ticks

The default for n is in the variable defaultnticks. Start value is
5.

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

This function is called by plot2d(). The user should prefer to call
plot2d(). xplot() without parameters shows only axis ticks and the
grid.

See:   plot (Euler Core),   plot2d (Plot Functions),   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 (Maxima Documentation)
```
```function setplotm
```
```  The user can choose the plotting coordinates with the mouse.

Returns plot coordinates.
```
```function niceform (x,n=10,f=1)
```
```  Return a string, containing a nicely formatted of x
```
```function gridstyle (st1:string=none, st2:string=none,
color=none, textcolor=none, framecolor=none, grid=none)
```
```  Set the grid styles and colors and the frame color.

st1 : axis lines
st2 : other grid lines
color : grid color
textcolor : default text color for plots
framecolor : frame color
grid : Number for grid styles (see plot2d)

See:   linestyle (Euler Core),   rgb (Plot Functions),   plot2d (Plot Functions),   plot2d (Maxima Documentation)
```
```function gridcolor (c:integer=3)
```
```  Set the grid color.
Returns the current color
See plot2d,rgb
```
```function comment fillcolor ([color1, color2])
```
```  Set the fill color for both sides of 3D plots.

fillcolor(none) or fillcolor() simply returns the old colors as a
1x2 vector of colors.
```
```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 grid styles are defaultgrid1,
defaultgrid2,defaultgridcolor.

See:   ygrid (Plot Functions),   plot2d (Plot Functions),   plot2d (Maxima Documentation)
```
```function xtick (x:real vector, s=none, latex=false)
```
```  Set non-conformal ticks to the x-axis

x : real or real vector
s : string, string vector or RGB image (if x is real)
latex : parse string in s through LaTeX

See:   xgrid (Plot Functions),   xaxis (Plot Functions),   xaxis (Maxima Documentation),   latex (Plot Functions)
```
```function ygrid (yy, f=1, grid=2, ticks=1, color=none, ..
yt=none, xlevel=none, textcolor=none, vertical=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().

>plot2d("x^3-x",<grid); plot()
[-2,  2,  -6,  6]
>ygrid(ticks(-6,6,n=4));
>xgrid(-2:2);

See:   xgrid (Plot Functions),   plot2d (Plot Functions),   plot2d (Maxima Documentation)
```
```function yaxis (x, yy=none, yt=none,
color=none, textcolor=none, style=none, gridstyle=none,
grid=false, vertical=false, left=true, axis=true,
zero=false, ticks=1, labels=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)
zero : draw the label for 0
ticks : draw small ticks at the labels

>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 (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,
zero=false, ticks=1, labels=true)
```
```  Draws a y-axis to the plot window

This function is similar to yaxis().

top : labels on top of the axis

See:   yaxis (Plot Functions),   yaxis (Maxima Documentation)
```
```function xrange ()
```
```  Writes the range of x below the x axis
```
```function xlabel (s, x:real=none, color=none, tcolor=0)
```
```  Puts the label text at the x-axis

s : string, string vector or RGB image
x : if present, x position of the label

>plot2d("sin(2pi*x)",0,1); ...
>xlabel(u"&phi;"); ...
>ylabel(u"sin(&phi;)"):

See:   text (Euler Core),   text (Plot Functions),   ylabel (Plot Functions),   ylabel (Maxima Documentation),   plot2d (Plot Functions),   plot2d (Maxima Documentation)
```
```function yrange ()
```
```  Writes the range of y besides the y axis.
```
```function ylabel (s,y=none,edge=none,vertical=none,
color=none,tcolor=0)
```
```  Puts the label text at the y-axis

edge : align with left of screen window
vertical : vertical text (on by default)

See:   xlabel (Plot Functions),   xlabel (Maxima Documentation)
```
```function plotwindow
```
```  Sets the plot window to the screen coordinates.

This function makes the screen coordinates and the plot coordinates
agree.
```
```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 (Plot Functions)
```
```function lowerwindow (title="")
```
```  Select the lower half of the plot window for a plot

See:   figure (Plot Functions)
```

```function args adaptiveeval (f\$:call, g\$:call, 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}

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation),   adaptiveevalone (Plot Functions),   adaptive (Numerical Algorithms)
```
```function args adaptiveevalone (g\$:call, 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.
amax is also the initial step size.
f and g can be expressions in x or user defined functions.
Returns {x,y}

See:   plot2d (Plot Functions),   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 (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 shading for a surface

This is used in various plot functions.

x,y,z : coordinates of the surface
l : direction of light
amb : ambient light
max : maximal hue value
hue : -2, -3, -4 for x, y, z direction (default 1)

```

## 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 (Plot Functions),   saveps (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 (Plot Functions),   saveps (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 (Plot Functions),   savesvg (Plot Functions)
```
```function fcontour (f\$,xmin=none,xmax=1,ymin=-1,ymax=1,r=none,
n=40,nc=defaultnc,hue=0,level="auto",
contourcolor=none, contourwidth=1,style="#",outline=1,frame=1)
```
```  Draw contour lines of a function or expression in x and y.

Obsolete. Use plot2d.

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

Obsolete. Use plot3d.

See:   plot3d (Plot Functions),   plot3d (Maxima Documentation)
```
```function flevel (f\$,level=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),   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),   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=1, contourwidth=1)
```
```  Implicit 3D plot contours at z-values.
```
```function solidhue (x:real, y:real, z:real, h:real,
f:number=1, level=none, nc:index=10, values=none,
contourcolor=1, contourwidth=1,
dl=none, breaks=none, limits=none,
linewidth=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 (Plot Functions),   plot3d (Plot Functions),   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),   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 (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 (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".
f\$ may be an expression in x.

Deprecated!

See:   plot2d (Plot Functions),   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",level=none,hue=1,
maps=0,contourcolor=1,contourwidth=1,
dl=none,limits=none, nc=defaultnc,
cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05)
```
```  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),   plot3d (Maxima Documentation)
```
```function f3dplotpolar (f\$,rmax=1,n=40,scale=1,fscale=1, ..
frame=1,wire=0,xlabel="x",ylabel="y",zlabel="z",maps=0,
cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05)
```
```  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),   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",
level="auto",hue=1,maps=0, dl=none, limits=none,
cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05, nc=defaultnc)
```
```  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),   plot3d (Maxima Documentation)
```
```function mark3 (x,y,z)
```
```  Plots points in three dimensions.

x,y,z must be 1xn vectors.

Obsolete. Use plot3d.

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

See:   plot2d (Plot Functions),   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 (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 (Maxima Documentation)
```
```function cplot (z)
```
```  Plots a grid of complex numbers.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation)
```
```function scale (z:real, scale:number=1,	center:number=0,
retscale:integer=0)
```
```  Scale the matrix z into [0,scale]

z : real matrix
scale : maximal absolute value of the returned matrix
retscale : returns the scaling factor f and center c too.

center : Scales into [-scale,scale]

If >retscale, the function returns {znew,f,c}.

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

This is a function used by plot3d with parameter scale=1.
Returns the scaled matrix and and the scaling factor.

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

This is a function used by plot3d.
Returns the scaled matrix and the scale.

See:   plot3d (Plot Functions),   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,
cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05, nc=defaultnc)
```
```  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),   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 (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 (Plot Functions),   plot3d (Maxima Documentation)
```
```function overwrite plotcubes (M, color=none,
xy=false, midpoints=false)
```
```  Plot cubes (parallel to the axes)

The rows of M contain [x1,x2,y1,y2,z2,z2] with lower and upper
limits for the sides of the cubes. The cubes are sorted either by
distance of the midpoint to the eye, or by distance of the
projection to the x-y-plane.

See:   plot3dbars (Plot Functions)
```
```function overwrite insimg (lines:index=35, 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 (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 (Plot Functions)
```
```function plotrgb (x:real, window:real vector=none, tcolor=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);
>plot2d(none,0,1,0,1); plotrgb(c);

See:   getwindowfromplot (Plot Functions)
```
```function overwrite loadimg (filename:string, lines:index=35,
scale:positive=1)
```
```  Insert an image from file.

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

filename : filename including extension (jpg or png)
n : maximal number of lines to be used
scale : scale with this factor

See:   insimg (Euler Core),   insimg (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, smaller=0)
```
```  figure (nc,nr) or figure(nc), figure(0) for sub-windows

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

smaller : if set, there is more space for vertical labels.

>figure(3,1,>smaller); ...
>figure(1); plot2d("sin(x)",0,2pi,yl="sin"); ...
>figure(2); plot2d("cos(x)",0,2pi,yl="cos"); ...
>figure(3); plot2d("sinc(x)",0,2pi,yl="sinc"); ...
>figure(0):

```
```function title (s, color=none, x:real=none)
```
```  Plots a title to the graphics window.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation),   plot3d (Plot Functions),   plot3d (Maxima Documentation)
```
```function settitle (s, color=none, x:real=none)
```
```  Plots a title to the graphics window.

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

See:   iterate (Numerical Algorithms),   sequence (Numerical Algorithms)
```
```function args vectorfield (f\$:string,
x1: real scalar=-2, x2: real scalar=2, ..
y1:real scalar=-2, y2: real scalar=2,
r=none,	cx=0, cy=0,
nx:index=20, ny:index=20,
thickness=1, color=black, frame=1,
plot=true)
```
```  Draw the vector field of a differential equation in x and y.

expr : expression "f(x,y)", which computes the
derivative of y(x) at x.
x1,x2,y1,y2 : bounds of the plot
r,cx,xy : alternative way to enter the bounds
nx, ny : number of arrows in each direction
thickness,color,frame : see plot2d
plot : do not plot but return x,y for later plots with plot2d().

>vectorfield("x*y",r=1,cx=1,cy=1):

See:   vectorfield2 (Plot Functions),   ode (Numerical Algorithms)
```
```function args vectorfield2 (f1\$:string, f2\$:string, ..
x1: real scalar=-2,x2: real scalar=2,
y1: real scalar=-2,y2: real scalar=2,
nx:index=20, ny:index=20,
r=none,	cx=0, cy=0,
nx:index=20, ny:index=20,
scale=1, normalize=0,
thickness=1, color=black, frame=1,
plot=true)
```
```  Draw the vector field of a differential equation in x and y.

expr1 and expr2 : expressions "f(x,y)", which compute the
x- and y-value of the derivative of y(x) at x.
scale : scaling factor for the arrows
x1,x2,y1,y2 : bounds of the plot
r,cx,xy : alternative way to enter the bounds
nx, ny : number of arrows in each direction
thickness,color,frame : see plot2d
normalize : derivative vectors are normalized
plot : do not plot but return x,y for later plots with plot2d().

>>vectorfield2("-y","x",r=1):
>vectorfield2("x","x*y",>normalize):

See:   ode (Numerical Algorithms)
```
```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),   plot3d (Maxima Documentation),   zoom (Plot Functions)
```
```function zoom (f:positive=none)
```
```  Set the zoom distance to d.

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

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

See:   view (Euler Core),   view (Maxima Documentation)
```
```function viewdistance (d:positive=none)
```
```  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),   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),   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 (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=none, 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.

This animates predefined images. The function was designed for
slower computers or for complicated plots. If the computer is fast
enough, plots can also be generated directly. Then wait() will
issue the display of the current plot.

For animate(), the pages must be generated with calls to addpage(),
as in the following example.

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

See:   addpage (Euler Core),   showpage (Euler Core),   wait (Euler Core),   rotate (Plot Functions)
```
```function rotate (f\$:string, d:real scalar=0.01, n:integer=120)
```
```  Shows a rotating animation of the plot f\$,

The plotting function f\$ must produce a 3D plot. This functions
used addpage() to pre-compute all plots. Seen the remarks in
animate() for an easier method.

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

See:   plot3d (Plot Functions),   plot3d (Maxima Documentation),   animate (Plot Functions)
```
```function view3d (f\$:string, d:real scalar=0.1)
```
```  Calls the plot f\$ and 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),   plot3d (Maxima Documentation)
```
```function fanimate (f\$:string, t:vector, d:real scalar=0.01)
```
```  Animate the function f\$

f\$ should display some graphics depending on t. Additional
parameters are passed to f. This function used addpage() to
pre-compute the plots. See the remarks in animate() for an easier
method.

```

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,fr=1)
```
```  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),   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,
cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05, nc=defaultnc,
linewidth=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),   plot3d (Maxima Documentation)
```
```function autolevel (a,b,nc,d=0.1)
```
```  Compute automatic levels between a and b
```
```function plotcontourplane (x, y, z, style=1, color=1,
level=none, delta=0.05, nc=defaultnc, grid=false,
contourcolor=none, scale=false, linewidth=none)
```
```  Plot a contour plane below the 3D plot

This is called by plot2d() if >cp is set. The functions projects
the contours of the plane with coordinates x,y,z to a plane below
the plot.

x,y,z : coordinates of the surface
style : 1=level lines only, 2=shading and level lines
level : "auto", "thick", "thin" or level values
If level is a 2xn matrix it plots ranges
cpcolor : color of the shading
cpdelta : distance from below the plot
nc : number of lines for automatic levels
grid : grid values for an additional grid.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation)
```
```function vieweye ()
```
```  The position of the eye depending on center and view
```
```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", ..
level=none, values=none,
light=[0.5,0.5,1], amb=0.1, max=0.9, huecolor=0, ..
contourcolor=1, contourwidth=1, z0=0,
frame=none, sframe=none,
dl=none, limits=none,
nc=defaultnc, cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05,
linewidth=none)
```
```  3D plot with hue, and optional level 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.

level : a row vector of level 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 level. 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),   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=none, rowsonly:integer=0, z0:real=0,
frame:real vector=none, sframe:real vector=none,
cp=0, cpcolor=1, cplevel="auto", cpdelta=0.05,
linewidth=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),   plot3d (Maxima Documentation),   rgb (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),   plot3d (Maxima Documentation),   rgb (Plot Functions)
```
```function overwrite subgrid (v)
```
```  Sets the sub-grid for grid plots

This is usually called by plot2d() automatically. The sub-grid
determines the number of grid lines which are drawn in a 3D plot.
This allows a finer plot than the visible grid lines indicate. In
plot2d(), the parameter grid= controls the sub-grids.

Calls the built-in function _subgrid, which works with 1x2 vectors.

>plot3d("x^2-y^3",grid=[10,5]):

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

## MatPlotLib

MatPlotLib is a very nice plotting library for Python. It has to be installed separately into Python. Consult the remarks about the installation of EMT for more details.

```function pyins (lines=35, close=true)
```
```  Insert a Python plot into the notebook

This saves a plot done with MatPlotLib in the working directory of
EMT, and loads the saved file to the current notebook. By default,
the plot is closed. Unclosed plots can be displayed with show() in
a separate window or saved in other formats too.

lines : number of lines for the plot in the notebook
close : close the plot

```

## Logarithmic Plots

These function should not be called directly. Use plot2d to produce log plots.

```function logticks (aa, bb=none, base=10)
```
```  Logarithmic ticks

See:   xlogplot (Plot Functions)
```
```function xlogplot (x:positive, y, xbase=10, color=1,
points=false, frame=1, grid=2, ticks=1)
```
```  Logarithmic plot

Instead of this, plot2d() should be used with the parameter
logplot=1.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation),   ylogplot (Plot Functions),   xylogplot (Plot Functions)
```
```function ylogplot (x, y:positive, ybase=10, color=1, points=false,
frame=1, grid=2, ticks=1)
```
```  Logarithmic plot

Instead of this, plot2d() should be used with the parameter
logplot=2.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation),   xlogplot (Plot Functions),   xylogplot (Plot Functions)
```
```function xylogplot (x:positive, y:positive,
xbase=10, ybase=10, color=1, points=0,
frame=1, grid=2, ticks=1)
```
```  Logarithmic plot

Instead of this, plot2d() should be used with the parameter
logplot=3.

See:   plot2d (Plot Functions),   plot2d (Maxima Documentation),   xlogplot (Plot Functions)
```

## LaTeX

LaTeX needs to be installed separately. I recommend MiKTeX for Windows. If you do not install the full package, you may have to wait a bit, when MiKTeX installs necessary packages. EMT may issue a warning.

```function comment tex (expr:string)
```
```  LaTeX code of the expression.

This calls Maxima to for the LaTeX code of the expression. The
result is a string.

```
```function overwrite texpng (latex:string,
usealias=true, factor=1.0, backcolor=-1, color=none)
```
```  PNG file containing the scanned LaTeX code.

LaTeX must be installed for this. The string will be inserted as a
display formula into a LaTeX document in the working directory of
EMT. Then LaTeX will be called to translate the document. Finally
the DVI file will be transformed into a PNG with "dvipng".

The text color is the current text color as set with textcolor(),
unless set as parameter color. The background color is the color
number 0 of the graphics, usually white. The font size is the
current font size. The scan is always tree times larger than
necessary to allow for anti-aliasing.

usealias : dvipng should alias the formula
factor : make the formula larger by this factor
transparent : use -1 for the current background color of the
graphics, and 0 for the background color of the text.
1 yields a transparent graphics. Note that loadrgb()
ignores transparency.
color : use another color for the text

The output is C:\Users\Username\Euler\eulertemp.png. It is usually
function label() does this.

This is calling the built-in function texpng() with the same
arguments.

See:   loadrgb (Euler Core),   label (Plot Functions),   label (Maxima Documentation),   xlabel (Plot Functions),   xlabel (Maxima Documentation),   ylabel (Plot Functions),   ylabel (Maxima Documentation),   setfont (Euler Core),   setfont (Basic Utilities),   latex: (Euler Core)
```
```function latex (s:string, color=none, factor=1.0)
```
```  RGB matrix containing the scanned LaTeX code.

s : LaTeX code
color : the text color; if none, the default text color is used.
factor: scale the Latex output by this factor.

This combines texpng() and loadrgb() to scan a LaTeX formula to an
RGB matrix. With plotrgb() such a matrix can be plotted into a plot
window. For more details, see texpng().

A symbolic expression can be transformed to Latex by Maxima with
tex(expr).

Returns an image as a matrix of RGB values.

>expr &= integrate(x^2*sin(x),x)
>plot2d(expr,0,2pi,grid=6); label(latex(tex(expr)),1,-10):

See:   text (Euler Core),   text (Plot Functions),   texpng (Plot Functions),   plotrgb (Plot Functions),   label (Plot Functions),   label (Maxima Documentation),   xlabel (Plot Functions),   xlabel (Maxima Documentation),   ylabel (Plot Functions),   ylabel (Maxima Documentation),   tex (Maxima Documentation)
```
```function overwrite text (s, c:real, r:real=none, color=none,
align:integer=-1, vertical=0,
left=none, center=none, right=none, up=none, down=none,
scale=1/3, tcolor=0)
```
```  Put text or RGB matrix on the screen.

This function works for a single string, a vector of strings, or an
RGB matrix of an image, e.g. a LaTeX formula. It can align the text
left, center, or right, or vertically up or down.

RGB images can be from the latex() function. This functions returns
three times enlarged images. Thus the default scale factor is 1/3.

s : string, string vector, or RGB image
c : column in screen coordinates or vector [c,r]
r : row in screen coordinates
color : text color
align : -1,0,1 for left, center, right
vertical : 0,1,2 for not vertical, up, down
left, center, right : sets align
up, down : sets vertical
scale : scale for the RGB image
tcolor : transparency color for the RGB image

>plot2d(''integrate("x^x",1,x)'',0,2,grid=6); ...
>text(latex("f(x) = 'integrate(t^t,t,1,x)"),toscreen(0.5,1)); ...
>g &= integrate(taylor(t^t,t,1,2),t,1,x); ...