[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
48.1 Introduction to draw | ||
48.2 Functions and Variables for draw | ||
48.3 Functions and Variables for pictures | ||
48.4 Functions and Variables for worldmap |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
draw
is a Maxima-Gnuplot interface.
There are three main functions to be used at Maxima level:
draw2d
, draw3d
and draw
.
Follow this link for more elaborated examples of this package:
http://www.telefonica.net/web2/biomates/maxima/gpdraw
You need Gnuplot 4.2 to run this program.
@ref{Category: Plotting} · @ref{Category: Share packages} · @ref{Category: Package draw}
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Default value: auto
If xrange
is auto
, the range for the x coordinate is
computed automatically.
If the user wants a specific interval for x, it must be given as a
Maxima list, as in xrange=[-2, 3]
.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [-3,5], explicit(x^2,x,-1,1))$
See also yrange
and zrange
.
@ref{Category: Package draw}
Default value: auto
If yrange
is auto
, the range for the y coordinate is
computed automatically.
If the user wants a specific interval for y, it must be given as a
Maxima list, as in yrange=[-2, 3]
.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(yrange = [-2,3], explicit(x^2,x,-1,1), xrange = [-3,3])$
See also xrange
and zrange
.
@ref{Category: Package draw}
Default value: auto
If zrange
is auto
, the range for the z coordinate is
computed automatically.
If the user wants a specific interval for z, it must be given as a
Maxima list, as in zrange=[-2, 3]
.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(yrange = [-3,3], zrange = [-2,5], explicit(x^2+y^2,x,-1,1,y,-1,1), xrange = [-3,3])$
See also xrange
and yrange
.
@ref{Category: Package draw}
Default value: false
If logx
is true
, the x axis will be drawn in the
logarithmic scale.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(log(x),x,0.01,5), logx = true)$
See also logy
and logz
.
@ref{Category: Package draw}
Default value: false
If logy
is true
, the y axis will be drawn in the
logarithmic scale.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(logy = true, explicit(exp(x),x,0,5))$
See also logx
and logz
.
@ref{Category: Package draw}
Default value: false
If logz
is true
, the z axis will be drawn in the
logarithmic scale.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(logz = true, explicit(exp(u^2+v^2),u,-2,2,v,-2,2))$
See also logx
and logy
.
@ref{Category: Package draw}
Default value: screen
Selects the terminal to be used by Gnuplot; possible values are:
screen
(default), png
, jpg
, eps
, eps_color
,
pdf
, pdfcairo
, gif
, animated_gif
, wxt
and aquaterm
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
N.B. pdfcairo requires Gnuplot 4.3. At this time (Nov 2008) Gnuplot 4.3 is a development version.
pdf requires Gnuplot 4.2/4.3 to be compiled with the option --enable-pdf
and libpdf must
be installed. The pdf library is available from: http://www.pdflib.com/en/download/pdflib-family/pdflib-lite/
Examples:
(%i1) load(draw)$ (%i2) /* screen terminal (default) */ draw2d(explicit(x^2,x,-1,1))$ (%i3) /* png file */ draw2d(terminal = 'png, pic_width = 300, explicit(x^2,x,-1,1))$ (%i4) /* jpg file */ draw2d(terminal = 'jpg, pic_width = 300, pic_height = 300, explicit(x^2,x,-1,1))$ (%i5) /* eps file */ draw2d(file_name = "myfile", explicit(x^2,x,-1,1), terminal = 'eps)$ (%i6) /* pdf file */ draw2d(file_name = "mypdf", pdf_width = 12.0, pdf_height = 8.0, explicit(x^2,x,-1,1), terminal = 'pdf)$ (%i7) /* wxwidgets window */ draw2d(explicit(x^2,x,-1,1), terminal = 'wxt)$
An animated gif file,
(%i1) load(draw)$ (%i2) draw( delay = 100, file_name = "zzz", terminal = 'animated_gif, gr2d(explicit(x^2,x,-1,1)), gr2d(explicit(x^3,x,-1,1)), gr2d(explicit(x^4,x,-1,1))); End of animation sequence (%o2) [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
Option delay
is only active in animated gif's; it is ignored in
any other case.
See also file_name
, pic_width
, pic_height
and delay
.
@ref{Category: Package draw}
Default value: ""
(empty string)
This option can be used to set the font face to be used by the terminal. Only one font face and size can be used throughout the plot.
Since this is a global graphics option, its position in the scene description does not matter.
See also font_size
.
Gnuplot doesn't handle fonts by itself, it leaves this task to the support libraries of the different terminals, each one with its own philosophy about it. A brief summary follows:
Example:
(%i1) load(draw)$ (%i2) draw2d(font = "Arial", font_size = 20, label(["Arial font, size 20",1,1]))$
GDFONTPATH
; in this case, it is only necessary to
set option font
to the font's name. It is also possible to
give the complete path to the font file.
Examples:
Option font
can be given the complete path to the font file:
(%i1) load(draw)$ (%i2) path: "/usr/share/fonts/truetype/freefont/" $ (%i3) file: "FreeSerifBoldItalic.ttf" $ (%i4) draw2d( font = concat(path, file), font_size = 20, color = red, label(["FreeSerifBoldItalic font, size 20",1,1]), terminal = png)$
If environment variable GDFONTPATH
is set to the
path where font files are allocated, it is possible to
set graphic option font
to the name of the font.
(%i1) load(draw)$ (%i2) draw2d( font = "FreeSerifBoldItalic", font_size = 20, color = red, label(["FreeSerifBoldItalic font, size 20",1,1]), terminal = png)$
"Times-Roman"
, "Times-Italic"
, "Times-Bold"
, "Times-BoldItalic"
, "Helvetica"
, "Helvetica-Oblique"
, "Helvetica-Bold"
, "Helvetic-BoldOblique"
, "Courier"
, "Courier-Oblique"
, "Courier-Bold"
, and "Courier-BoldOblique"
.
Example:
(%i1) load(draw)$ (%i2) draw2d( font = "Courier-Oblique", font_size = 15, label(["Courier-Oblique font, size 15",1,1]), terminal = eps)$
fontconfig
utility.
"Times-Roman"
.
The gnuplot documentation is an important source of information about terminals and fonts.
@ref{Category: Package draw}
Default value: 12
This option can be used to set the font size to be used by the terminal.
Only one font face and size can be used throughout the plot. font_size
is
active only when option font
is not equal to the empty string.
Since this is a global graphics option, its position in the scene description does not matter.
See also font
.
@ref{Category: Package draw}
Default value: false
If grid
is true
, a grid will be drawn on the xy plane.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(grid = true, explicit(exp(u),u,-2,2))$
@ref{Category: Package draw}
Default value: ""
(empty string)
Option title
, a string, is the main title for the scene.
By default, no title is written.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(exp(u),u,-2,2), title = "Exponential function")$
@ref{Category: Package draw}
Default value: ""
(empty string)
Option xlabel
, a string, is the label for the x axis.
By default, no label is written.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(xlabel = "Time", explicit(exp(u),u,-2,2), ylabel = "Population")$
See also ylabel
, and zlabel
.
@ref{Category: Package draw}
Default value: ""
(empty string)
Option ylabel
, a string, is the label for the y axis.
By default, no label is written.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(xlabel = "Time", ylabel = "Population", explicit(exp(u),u,-2,2) )$
See also xlabel
, and zlabel
.
@ref{Category: Package draw}
Default value: ""
(empty string)
Option zlabel
, a string, is the label for the z axis.
By default, no label is written.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(zlabel = "Z variable", ylabel = "Y variable", explicit(sin(x^2+y^2),x,-2,2,y,-2,2), xlabel = "X variable" )$
See also xlabel
, and ylabel
.
@ref{Category: Package draw}
Default value: auto
This graphic option controls the way tic marks are drawn on the x axis.
xtics
is bounded to symbol auto, tic marks are
drawn automatically.
xtics
is bounded to symbol none, tic marks are
not drawn.
xtics
is bounded to a positive number, this is the distance
between two consecutive tic marks.
xtics
is bounded to a list of length three of the
form [start,incr,end]
, tic marks are plotted from start
to end
at intervals of length incr
.
xtics
is bounded to a set of numbers of the
form {n1, n2, ...}
, tic marks are plotted at values n1
,
n2
, ...
xtics
is bounded to a set of pairs of the
form {["label1", n1], ["label2", n2], ...}
, tic marks corresponding to values n1
,
n2
, ... are labeled with "label1"
, "label2"
, ..., respectively.
Since this is a global graphics option, its position in the scene description does not matter.
Examples:
Disable tics.
(%i1) load(draw)$ (%i2) draw2d(xtics = 'none, explicit(x^3,x,-1,1) )$
Tics every 1/4 units.
(%i1) load(draw)$ (%i2) draw2d(xtics = 1/4, explicit(x^3,x,-1,1) )$
Tics from -3/4 to 3/4 in steps of 1/8.
(%i1) load(draw)$ (%i2) draw2d(xtics = [-3/4,1/8,3/4], explicit(x^3,x,-1,1) )$
Tics at points -1/2, -1/4 and 3/4.
(%i1) load(draw)$ (%i2) draw2d(xtics = {-1/2,-1/4,3/4}, explicit(x^3,x,-1,1) )$
Labeled tics.
(%i1) load(draw)$ (%i2) draw2d(xtics = {["High",0.75],["Medium",0],["Low",-0.75]}, explicit(x^3,x,-1,1) )$
See also ytics
, and ztics
.
@ref{Category: Package draw}
Default value: auto
This graphic option controls the way tic marks are drawn on the y axis.
See xtics
for a complete description.
@ref{Category: Package draw}
Default value: auto
This graphic option controls the way tic marks are drawn on the z axis.
See xtics
for a complete description.
@ref{Category: Package draw}
Default value: false
If xtics_rotate
is true
, tic marks on the x axis are rotated
90 degrees.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: false
If ytics_rotate
is true
, tic marks on the y axis are rotated
90 degrees.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: false
If ztics_rotate
is true
, tic marks on the z axis are rotated
90 degrees.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: false
If xtics_axis
is true
, tic marks and their labels are plotted just
along the x axis, if it is false
tics are plotted on the border.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: false
If ytics_axis
is true
, tic marks and their labels are plotted just
along the y axis, if it is false
tics are plotted on the border.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: false
If ztics_axis
is true
, tic marks and their labels are plotted just
along the z axis, if it is false
tics are plotted on the border.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: false
If xaxis
is true
, the x axis is drawn.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), xaxis = true, xaxis_color = blue)$
See also xaxis_width
, xaxis_type
and xaxis_color
.
@ref{Category: Package draw}
Default value: 1
xaxis_width
is the width of the x axis.
Its value must be a positive number.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), xaxis = true, xaxis_width = 3)$
See also xaxis
, xaxis_type
and xaxis_color
.
@ref{Category: Package draw}
Default value: dots
xaxis_type
indicates how the x axis is displayed;
possible values are solid
and dots
.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), xaxis = true, xaxis_type = solid)$
See also xaxis
, xaxis_width
and xaxis_color
.
@ref{Category: Package draw}
Default value: "black"
xaxis_color
specifies the color for the x axis. See
color
to know how colors are defined.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), xaxis = true, xaxis_color = red)$
See also xaxis
, xaxis_width
and xaxis_type
.
@ref{Category: Package draw}
Default value: false
If yaxis
is true
, the y axis is drawn.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), yaxis = true, yaxis_color = blue)$
See also yaxis_width
, yaxis_type
and yaxis_color
.
@ref{Category: Package draw}
Default value: 1
yaxis_width
is the width of the y axis.
Its value must be a positive number.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), yaxis = true, yaxis_width = 3)$
See also yaxis
, yaxis_type
and yaxis_color
.
@ref{Category: Package draw}
Default value: dots
yaxis_type
indicates how the y axis is displayed;
possible values are solid
and dots
.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), yaxis = true, yaxis_type = solid)$
See also yaxis
, yaxis_width
and yaxis_color
.
@ref{Category: Package draw}
Default value: "black"
yaxis_color
specifies the color for the y axis. See
color
to know how colors are defined.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^3,x,-1,1), yaxis = true, yaxis_color = red)$
See also yaxis
, yaxis_width
and yaxis_type
.
@ref{Category: Package draw}
Default value: false
If zaxis
is true
, the z axis is drawn in 3D plots.
This option has no effect in 2D scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1), zaxis = true, zaxis_type = solid, zaxis_color = blue)$
See also zaxis_width
, zaxis_type
and zaxis_color
.
@ref{Category: Package draw}
Default value: 1
zaxis_width
is the width of the z axis.
Its value must be a positive number. This option has no effect in 2D scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1), zaxis = true, zaxis_type = solid, zaxis_width = 3)$
See also zaxis
, zaxis_type
and zaxis_color
.
@ref{Category: Package draw}
Default value: dots
zaxis_type
indicates how the z axis is displayed;
possible values are solid
and dots
.
This option has no effect in 2D scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1), zaxis = true, zaxis_type = solid)$
See also zaxis
, zaxis_width
and zaxis_color
.
@ref{Category: Package draw}
Default value: "black"
zaxis_color
specifies the color for the z axis. See
color
to know how colors are defined.
This option has no effect in 2D scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1), zaxis = true, zaxis_type = solid, zaxis_color = red)$
See also zaxis
, zaxis_width
and zaxis_type
.
@ref{Category: Package draw}
Default value: false
Allocates the xy-plane in 3D scenes. When xyplane
is
false
, the xy-plane is placed automatically; when it is
a real number, the xy-plane intersects the z-axis at this level.
This option has no effect in 2D scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(xyplane = %e-2, explicit(x^2+y^2,x,-1,1,y,-1,1))$
@ref{Category: Package draw}
Default value: 60
rot_vertical
is the angle (in degrees) of vertical rotation (around
the x axis) to set the view point in 3d scenes.
The angle is bounded to the [0, 180] interval.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(rot_vertical = 170, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
See also rot_horizontal
.
@ref{Category: Package draw}
Default value: 30
rot_horizontal
is the angle (in degrees) of horizontal rotation (around
the z axis) to set the view point in 3d scenes.
The angle is bounded to the [0, 360] interval.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(rot_vertical = 170, rot_horizontal = 360, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
See also rot_vertical
.
@ref{Category: Package draw}
Default value: ""
(empty string)
xy_file
is the name of the file where the coordinates will be saved
after clicking with the mouse button and hitting the 'x' key. By default,
no coordinates are saved.
Since this is a global graphics option, its position in the scene description does not matter.
@ref{Category: Package draw}
Default value: ""
(empty string)
Expert Gnuplot users can make use of this option to fine tune Gnuplot's
behaviour by writing settings to be sent before the plot
or splot
command.
The value of this option must be a string or a list of strings (one per line).
Since this is a global graphics option, its position in the scene description does not matter.
Example:
The dumb terminal is not supported by package draw
,
but it is possible to set it by making use of option user_preamble
,
(%i1) load(draw)$ (%i2) draw2d(explicit(exp(x)-1,x,-1,1), parametric(cos(u),sin(u),u,0,2*%pi), user_preamble="set terminal dumb")$
@ref{Category: Package draw}
Default value: "maxima_out"
This is the name of the file where terminals png
, jpg
, eps
,
eps_color
, pdf
and pdfcairo
will save the graphic.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(file_name = "myfile", explicit(x^2,x,-1,1), terminal = 'png)$
See also terminal
, pic_width
, and pic_height
.
@ref{Category: Package draw}
Default value: 5
This is the delay in 1/100 seconds of frames in animated gif files.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw( delay = 100, file_name = "zzz", terminal = 'animated_gif, gr2d(explicit(x^2,x,-1,1)), gr2d(explicit(x^3,x,-1,1)), gr2d(explicit(x^4,x,-1,1))); End of animation sequence (%o2) [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
Option delay
is only active in animated gif's; it is ignored in
any other case.
See also terminal
, pic_width
, and pic_height
.
@ref{Category: Package draw}
Default value: 640
This is the width of the bitmap file generated by terminals png
and jpg
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = 'png, pic_width = 300, pic_height = 300, explicit(x^2,x,-1,1))$
See also terminal
, file_name
, and pic_height
.
@ref{Category: Package draw}
Default value: 640
This is the height of the bitmap file generated by terminals png
and jpg
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = 'png, pic_width = 300, pic_height = 300, explicit(x^2,x,-1,1))$
See also terminal
, file_name
, and pic_width
.
@ref{Category: Package draw}
Default value: 12
This is the width (measured in cm) of the Postscript file
generated by terminals eps
and eps_color
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = 'eps, eps_width = 3, eps_height = 3, explicit(x^2,x,-1,1))$
See also terminal
, file_name
, and eps_height
.
@ref{Category: Package draw}
Default value: 8
This is the height (measured in cm) of the Postscript file
generated by terminals eps
and eps_color
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = 'eps, eps_width = 3, eps_height = 3, explicit(x^2,x,-1,1))$
See also terminal
, file_name
, and eps_width
.
@ref{Category: Package draw}
Default value: 21.0 (A4 portrait width)
This is the width (measured in cm) of the PDF document
generated by terminals pdf
and pdfcairo
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = 'pdf, pdf_width = 3.0, pdf_height = 3.0, explicit(x^2,x,-1,1))$
See also terminal
, file_name
, and pdf_height
.
@ref{Category: Package draw}
Default value: 29.7 (A4 portrait height)
This is the height (measured in cm) of the PDF document
generated by terminals pdf
and pdfcairo
.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = 'pdf, pdf_width = 3.0, pdf_height = 3.0, explicit(x^2,x,-1,1))$
See also terminal
, file_name
, and pdf_width
.
@ref{Category: Package draw}
Default value: true
If axis_bottom
is true
, the bottom axis is shown in 2d scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(axis_bottom = false, explicit(x^3,x,-1,1))$
See also axis_left
, axis_top
, axis_right
, and axis_3d
.
@ref{Category: Package draw}
Default value: true
If axis_left
is true
, the left axis is shown in 2d scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(axis_left = false, explicit(x^3,x,-1,1))$
See also axis_bottom
, axis_top
, axis_right
, and axis_3d
.
@ref{Category: Package draw}
Default value: true
If axis_top
is true
, the top axis is shown in 2d scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(axis_top = false, explicit(x^3,x,-1,1))$
See also axis_bottom
, axis_left
, axis_right
, and axis_3d
.
@ref{Category: Package draw}
Default value: true
If axis_right
is true
, the right axis is shown in 2d scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw2d(axis_right = false, explicit(x^3,x,-1,1))$
See also axis_bottom
, axis_left
, axis_top
, and axis_3d
.
@ref{Category: Package draw}
Default value: true
If axis_3d
is true
, the x, y and z axis are shown in 3d scenes.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(axis_3d = false, explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
See also axis_bottom
, axis_left
, axis_top
, and axis_right
for axis in 2d.
@ref{Category: Package draw}
Default value: color
palette
indicates how to map the real values of a matrix
passed to object image
onto color components.
palette
is a vector of length three with components
ranging from -36 to +36; each value is an index for a formula mapping the levels
onto red, green and blue colors, respectively:
0: 0 1: 0.5 2: 1 3: x 4: x^2 5: x^3 6: x^4 7: sqrt(x) 8: sqrt(sqrt(x)) 9: sin(90x) 10: cos(90x) 11: |x-0.5| 12: (2x-1)^2 13: sin(180x) 14: |cos(180x)| 15: sin(360x) 16: cos(360x) 17: |sin(360x)| 18: |cos(360x)| 19: |sin(720x)| 20: |cos(720x)| 21: 3x 22: 3x-1 23: 3x-2 24: |3x-1| 25: |3x-2| 26: (3x-1)/2 27: (3x-2)/2 28: |(3x-1)/2| 29: |(3x-2)/2| 30: x/0.32-0.78125 31: 2*x-0.84 32: 4x;1;-2x+1.84;x/0.08-11.5 33: |2*x - 0.5| 34: 2*x 35: 2*x - 0.5 36: 2*x - 1
negative numbers mean negative colour component.
palette = gray
and palette = color
are short cuts for
palette = [3,3,3]
and palette = [7,5,15]
, respectively.
Since this is a global graphics option, its position in the scene description does not matter.
Examples:
(%i1) load(draw)$ (%i2) im: apply( 'matrix, makelist(makelist(random(200),i,1,30),i,1,30))$ (%i3) /* palette = color, default */ draw2d(image(im,0,0,30,30))$ (%i4) draw2d(palette = gray, image(im,0,0,30,30))$ (%i5) draw2d(palette = [15,20,-4], colorbox=false, image(im,0,0,30,30))$
See also colorbox
.
@ref{Category: Package draw}
Default value: true
If colorbox
is true
, a color scale is drawn together with
image
objects.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) im: apply('matrix, makelist(makelist(random(200),i,1,30),i,1,30))$ (%i3) draw2d(image(im,0,0,30,30))$ (%i4) draw2d(colorbox=false, image(im,0,0,30,30))$
See also palette
.
@ref{Category: Package draw}
Default value: false
If enhanced3d
is false
, surfaces are not colored in 3d plots.
If enhanced3d
is true
, surfaces are colored setting Gnuplot's
pm3d mode. If an expression is given to enhanced3d
, it will be used
to assign colors according to the palette
; variables in this expression
must be the same used in the surface description.
See option palette
to learn how palettes are specified.
Examples:
(%i1) load(draw)$ (%i2) draw3d( surface_hide = true, enhanced3d = true, palette = gray, explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$ (%i3) draw3d( surface_hide = true, /* same variables x and y as */ /* in explicit below: */ enhanced3d = sin(x*y), explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
@ref{Category: Package draw}
Default value: false
Option meshed_surface
has effect only when option enhanced3d
is
not false
. In such case, if meshed_surface
is false
,
only the colored surface is plotted. If its value is true
, both the
colored surface and the mesh lines are plotted.
Only explicit
functions in 3d and parametric_surface
objects are
affected by this option.
See also enhanced3d
.
Examples:
(%i1) load(draw)$ (%i2) draw3d ( enhanced3d = true, color = green, meshed_surface = true, explicit(x^2+y^2, x,-2,2,y,-2,2)) $ (%i3) draw3d ( enhanced3d = true, surface_hide = true, color = green, meshed_surface = true, parametric_surface(x^2,y,x+y, x,-2,2,y,-2,2)) $
@ref{Category: Package draw}
Default value: 1
point_size
sets the size for plotted points. It must be a
non negative number.
This option has no effect when graphic option point_type
is
set to dot
.
This option affects the following graphic objects:
gr2d
: points
.
gr3d
: points
.
Example:
(%i1) load(draw)$ (%i2) draw2d(points(makelist([random(20),random(50)],k,1,10)), point_size = 5, points(makelist(k,k,1,20),makelist(random(30),k,1,20)))$
@ref{Category: Package draw}
Default value: 1
point_type
indicates how isolated points are displayed; the value of this
option can be any integer index greater or equal than -1, or the name of
a point style: $none
(-1), dot
(0), plus
(1), multiply
(2),
asterisk
(3), square
(4), filled_square
(5), circle
(6),
filled_circle
(7), up_triangle
(8), filled_up_triangle
(9),
down_triangle
(10), filled_down_triangle
(11), diamant
(12) and
filled_diamant
(13).
This option affects the following graphic objects:
gr2d
: points
.
gr3d
: points
.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,10], point_size = 3, point_type = diamant, points([[1,1],[5,1],[9,1]]), point_type = filled_down_triangle, points([[1,2],[5,2],[9,2]]), point_type = asterisk, points([[1,3],[5,3],[9,3]]), point_type = filled_diamant, points([[1,4],[5,4],[9,4]]), point_type = 5, points([[1,5],[5,5],[9,5]]), point_type = 6, points([[1,6],[5,6],[9,6]]), point_type = filled_circle, points([[1,7],[5,7],[9,7]]), point_type = 8, points([[1,8],[5,8],[9,8]]), point_type = filled_diamant, points([[1,9],[5,9],[9,9]]) )$
@ref{Category: Package draw}
Default value: false
When points_joined
is true
, points are joined by lines; when false
,
isolated points are drawn. A third possible value for this graphic option is
impulses
; in such case, vertical segments are drawn from points to the x-axis (2D)
or to the xy-plane (3D).
This option affects the following graphic objects:
gr2d
: points
.
gr3d
: points
.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,4], point_size = 3, point_type = up_triangle, color = blue, points([[1,1],[5,1],[9,1]]), points_joined = true, point_type = square, line_type = dots, points([[1,2],[5,2],[9,2]]), point_type = circle, color = red, line_width = 7, points([[1,3],[5,3],[9,3]]) )$
@ref{Category: Package draw}
Default value: false
Option filled_func
controls how regions limited by functions
should be filled. When filled_func
is true
, the region
bounded by the function defined with object explicit
and the
bottom of the graphic window is filled with fill_color
. When
filled_func
contains a function expression, then the region bounded
by this function and the function defined with object explicit
will be filled. By default, explicit functions are not filled.
This option affects only the 2d graphic object explicit
.
Example:
Region bounded by an explicit
object and the bottom of the
graphic window.
(%i1) load(draw)$ (%i2) draw2d(fill_color = red, filled_func = true, explicit(sin(x),x,0,10) )$
Region bounded by an explicit
object and the function
defined by option filled_func
. Note that the variable in
filled_func
must be the same as that used in explicit
.
(%i1) load(draw)$ (%i2) draw2d(fill_color = grey, filled_func = sin(x), explicit(-sin(x),x,0,%pi));
See also fill_color
and explicit
.
@ref{Category: Package draw}
Default value: false
If transparent
is true
, interior regions of polygons are
filled according to fill_color
.
This option affects the following graphic objects:
gr2d
: polygon
, rectangle
, and ellipse
.
Example:
(%i1) load(draw)$ (%i2) draw2d(polygon([[3,2],[7,2],[5,5]]), transparent = true, color = blue, polygon([[5,2],[9,2],[7,5]]) )$
@ref{Category: Package draw}
Default value: true
If border
is true
, borders of polygons are painted
according to line_type
and line_width
.
This option affects the following graphic objects:
gr2d
: polygon
, rectangle
, and ellipse
.
Example:
(%i1) load(draw)$ (%i2) draw2d(color = brown, line_width = 8, polygon([[3,2],[7,2],[5,5]]), border = false, fill_color = blue, polygon([[5,2],[9,2],[7,5]]) )$
@ref{Category: Package draw}
Default value: false
If head_both
is true
, vectors are plotted with two arrow heads.
If false
, only one arrow is plotted.
This option is relevant only for vector
objects.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,8], yrange = [0,8], head_length = 0.7, vector([1,1],[6,0]), head_both = true, vector([1,7],[6,0]) )$
See also head_length
, head_angle
, and head_type
.
@ref{Category: Package draw}
Default value: 2
head_length
indicates, in x-axis units, the length of arrow heads.
This option is relevant only for vector
objects.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,12], yrange = [0,8], vector([0,1],[5,5]), head_length = 1, vector([2,1],[5,5]), head_length = 0.5, vector([4,1],[5,5]), head_length = 0.25, vector([6,1],[5,5]))$
See also head_both
, head_angle
, and head_type
.
@ref{Category: Package draw}
Default value: 45
head_angle
indicates the angle, in degrees, between the arrow heads and
the segment.
This option is relevant only for vector
objects.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,9], head_length = 0.7, head_angle = 10, vector([1,1],[0,6]), head_angle = 20, vector([2,1],[0,6]), head_angle = 30, vector([3,1],[0,6]), head_angle = 40, vector([4,1],[0,6]), head_angle = 60, vector([5,1],[0,6]), head_angle = 90, vector([6,1],[0,6]), head_angle = 120, vector([7,1],[0,6]), head_angle = 160, vector([8,1],[0,6]), head_angle = 180, vector([9,1],[0,6]) )$
See also head_both
, head_length
, and head_type
.
@ref{Category: Package draw}
Default value: filled
head_type
is used to specify how arrow heads are plotted. Possible
values are: filled
(closed and filled arrow heads), empty
(closed but not filled arrow heads), and nofilled
(open arrow heads).
This option is relevant only for vector
objects.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,12], yrange = [0,10], head_length = 1, vector([0,1],[5,5]), /* default type */ head_type = 'empty, vector([3,1],[5,5]), head_type = 'nofilled, vector([6,1],[5,5]))$
See also head_both
, head_angle
, and head_length
.
@ref{Category: Package draw}
Default value: false
If unit_vectors
is true
, vectors are plotted with module 1.
This is useful for plotting vector fields. If unit_vectors
is false
,
vectors are plotted with its original length.
This option is relevant only for vector
objects.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [-1,6], yrange = [-1,6], head_length = 0.1, vector([0,0],[5,2]), unit_vectors = true, color = red, vector([0,3],[5,2]))$
@ref{Category: Package draw}
Default value: center
label_alignment
is used to specify where to write labels with
respect to the given coordinates. Possible values are: center
,
left
, and right
.
This option is relevant only for label
objects.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,10], points_joined = true, points([[5,0],[5,10]]), color = blue, label(["Centered alignment (default)",5,2]), label_alignment = 'left, label(["Left alignment",5,5]), label_alignment = 'right, label(["Right alignment",5,8]))$
See also label_orientation
, and color
.
@ref{Category: Package draw}
Default value: horizontal
label_orientation
is used to specify orientation of labels.
Possible values are: horizontal
, and vertical
.
This option is relevant only for label
objects.
Example:
In this example, a dummy point is added to get an image.
Package draw
needs always data to draw an scene.
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,10], yrange = [0,10], point_size = 0, points([[5,5]]), color = navy, label(["Horizontal orientation (default)",5,2]), label_orientation = 'vertical, color = "#654321", label(["Vertical orientation",1,5]))$
See also label_alignment
and color
.
@ref{Category: Package draw}
Default value: "black"
color
specifies the color for plotting lines, points, borders of
polygons and labels.
Colors can be given as names or in hexadecimal rgb code.
Available color names are:
"white"
, "black"
, "gray0"
, "grey0"
, "gray10"
,
"grey10"
, "gray20"
, "grey20"
, "gray30"
, "grey30"
,
"gray40"
, "grey40"
, "gray50"
, "grey50"
, "gray60"
,
"grey60"
, "gray70"
, "grey70"
, "gray80"
, "grey80"
,
"gray90"
, "grey90"
, "gray100"
, "grey100"
, "gray"
,
"grey"
, "light-gray"
, "light-grey"
, "dark-gray"
,
"dark-grey"
, "red"
, "light-red"
, "dark-red"
, "yellow"
,
"light-yellow"
, "dark-yellow"
, "green"
, "light-green"
,
"dark-green"
, "spring-green"
, "forest-green"
, "sea-green"
,
"blue"
, "light-blue"
, "dark-blue"
, "midnight-blue"
,
"navy"
, "medium-blue"
, "royalblue"
, "skyblue"
,
"cyan"
, "light-cyan"
, "dark-cyan"
, "magenta"
,
"light-magenta"
, "dark-magenta"
, "turquoise"
,
"light-turquoise"
, "dark-turquoise"
, "pink"
, "light-pink"
,
"dark-pink"
, "coral"
, "light-coral"
, "orange-red"
,
"salmon"
, "light-salmon"
, "dark-salmon"
, "aquamarine"
,
"khaki"
, "dark-khaki"
, "goldenrod"
, "light-goldenrod"
,
"dark-goldenrod"
, "gold"
, "beige"
, "brown"
, "orange"
,
"dark-orange"
, "violet"
, "dark-violet"
, "plum"
and "purple"
.
Cromatic componentes in hexadecimal code are introduced in the form "#rrggbb"
.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^2,x,-1,1), /* default is black */ color = "red", explicit(0.5 + x^2,x,-1,1), color = blue, explicit(1 + x^2,x,-1,1), color = "light-blue", /* double quotes if - is used */ explicit(1.5 + x^2,x,-1,1), color = "#23ab0f", label(["This is a label",0,1.2]) )$
See also fill_color
.
@ref{Category: Package draw}
Default value: "red"
fill_color
specifies the color for filling polygons and
2d explicit
functions.
See color
to learn how colors are specified.
@ref{Category: Package draw}
Default value: 0
fill_density
is a number between 0 and 1 that specifies
the intensity of the fill_color
in bars
objects.
See bars
for examples.
Default value: 1
line_width
is the width of plotted lines.
Its value must be a positive number.
This option affects the following graphic objects:
gr2d
: points
, polygon
, rectangle
,
ellipse
, vector
, explicit
, implicit
,
parametric
and polar
.
gr3d
: points
and parametric
.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(x^2,x,-1,1), /* default width */ line_width = 5.5, explicit(1 + x^2,x,-1,1), line_width = 10, explicit(2 + x^2,x,-1,1))$
See also line_type
.
@ref{Category: Package draw}
Default value: solid
line_type
indicates how lines are displayed; possible values are
solid
and dots
.
This option affects the following graphic objects:
gr2d
: points
, polygon
, rectangle
,
ellipse
, vector
, explicit
, implicit
,
parametric
and polar
.
gr3d
: points
, explicit
, parametric
and parametric_surface
.
Example:
(%i1) load(draw)$ (%i2) draw2d(line_type = dots, explicit(1 + x^2,x,-1,1), line_type = solid, /* default */ explicit(2 + x^2,x,-1,1))$
See also line_width
.
@ref{Category: Package draw}
Default value: 30
In 2d, nticks
gives the initial number of points used by the
adaptive plotting routine for explicit objects. It is also the
number of points that will be shown in parametric and polar curves.
This option affects the following graphic objects:
gr2d
: ellipse
, explicit
, parametric
and polar
.
gr3d
: parametric
.
Example:
(%i1) load(draw)$ (%i2) draw2d(transparent = true, ellipse(0,0,4,2,0,180), nticks = 5, ellipse(0,0,4,2,180,180) )$
@ref{Category: Package draw}
Default value: 10
adapt_depth
is the maximum number of splittings used by the adaptive plotting routine.
This option is relevant only for 2d explicit
functions.
@ref{Category: Package draw}
Default value: ""
(empty string)
key
is the name of a function in the legend. If key
is an
empty string, no key is assigned to the function.
This option affects the following graphic objects:
gr2d
: points
, polygon
, rectangle
,
ellipse
, vector
, explicit
, implicit
,
parametric
, and polar
.
gr3d
: points
, explicit
, parametric
,
and parametric_surface
.
Example:
(%i1) load(draw)$ (%i2) draw2d(key = "Sinus", explicit(sin(x),x,0,10), key = "Cosinus", color = red, explicit(cos(x),x,0,10) )$
@ref{Category: Package draw}
Default value: 30
xu_grid
is the number of coordinates of the first variable
(x
in explicit and u
in parametric 3d surfaces) to
build the grid of sample points.
This option affects the following graphic objects:
gr3d
: explicit
and parametric_surface
.
Example:
(%i1) load(draw)$ (%i2) draw3d(xu_grid = 10, yv_grid = 50, explicit(x^2+y^2,x,-3,3,y,-3,3) )$
See also yv_grid
.
@ref{Category: Package draw}
Default value: 30
yv_grid
is the number of coordinates of the second variable
(y
in explicit and v
in parametric 3d surfaces) to
build the grid of sample points.
This option affects the following graphic objects:
gr3d
: explicit
and parametric_surface
.
Example:
(%i1) load(draw)$ (%i2) draw3d(xu_grid = 10, yv_grid = 50, explicit(x^2+y^2,x,-3,3,y,-3,3) )$
See also xu_grid
.
@ref{Category: Package draw}
Default value: false
If surface_hide
is true
, hidden parts are not plotted in 3d surfaces.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw(columns=2, gr3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)), gr3d(surface_hide = true, explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)) )$
@ref{Category: Package draw}
Default value: none
Option contour
enables the user to select where to plot contour lines.
Possible values are:
none
:
no contour lines are plotted.
base
:
contour lines are projected on the xy plane.
surface
:
contour lines are plotted on the surface.
both
:
two contour lines are plotted: on the xy plane and on the surface.
map
:
contour lines are projected on the xy plane, and the view point is
set just in the vertical.
Since this is a global graphics option, its position in the scene description does not matter.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = 15, contour = both, surface_hide = true) $
@ref{Category: Package draw}
Default value: 5
This graphic option controls the way contours are drawn.
contour_levels
can be set to a positive integer number, a list of three
numbers or an arbitrary set of numbers:
contour_levels
is bounded to positive integer n,
n contour lines will be drawn at equal intervals. By default, five
equally spaced contours are plotted.
contour_levels
is bounded to a list of length three of the
form [lowest,s,highest]
, contour lines are plotted from lowest
to highest
in steps of s
.
contour_levels
is bounded to a set of numbers of the
form {n1, n2, ...}
, contour lines are plotted at values n1
,
n2
, ...
Since this is a global graphics option, its position in the scene description does not matter.
Examples:
Ten equally spaced contour lines. The actual number of levels can be adjusted to give simple labels.
(%i1) load(draw)$ (%i2) draw3d(color = green, explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = 10, contour = both, surface_hide = true) $
From -8 to 8 in steps of 4.
(%i1) load(draw)$ (%i2) draw3d(color = green, explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = [-8,4,8], contour = both, surface_hide = true) $
Isolines at levels -7, -6, 0.8 and 5.
(%i1) load(draw)$ (%i2) draw3d(color = green, explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3), contour_levels = {-7, -6, 0.8, 5}, contour = both, surface_hide = true) $
See also contour
.
@ref{Category: Package draw}
Default value: 1
columns
is the number of columns in multiple plots.
Since this is a global graphics option, its position in the scene description
does not matter. It can be also used as an argument of function draw
.
Example:
(%i1) load(draw)$ (%i2) scene1: gr2d(title="Ellipse", nticks=30, parametric(2*cos(t),5*sin(t),t,0,2*%pi))$ (%i3) scene2: gr2d(title="Triangle", polygon([4,5,7],[6,4,2]))$ (%i4) draw(scene1, scene2, columns = 2)$
@ref{Category: Package draw}
Default value: [50, 50]
ip_grid
sets the grid for the first sampling in implicit plots.
This option is relevant only for implicit
objects.
@ref{Category: Package draw}
Default value: [5, 5]
ip_grid_in
sets the grid for the second sampling in implicit plots.
This option is relevant only for implicit
objects.
@ref{Category: Package draw}
Default value: 10
x_voxel
is the number of voxels in the x direction to
be used by the marching cubes algorithm implemented
by the 3d implicit
object.
@ref{Category: Package draw}
Default value: 10
y_voxel
is the number of voxels in the y direction to
be used by the marching cubes algorithm implemented
by the 3d implicit
object.
@ref{Category: Package draw}
Default value: 10
z_voxel
is the number of voxels in the z direction to
be used by the marching cubes algorithm implemented
by the 3d implicit
object.
@ref{Category: Package draw}
Function gr2d
builds an object describing a 2D scene. Arguments are
graphic options and graphic objects. This scene is interpreted
sequentially: graphic options affect those graphic objects placed
on its right. Some graphic options affect the global appearence of the scene.
This is the list of graphic objects available for scenes in two dimensions:
points
, polygon
, rectangle
, bars
, ellipse
, label
,
vector
, explicit
, implicit
, polar
, parametric
,
image
and geomap
.
See also the following global graphic options: xrange
, yrange
,
logx
, logy
, terminal
, grid
, title
,
xlabel
, ylabel
, xtics
, ytics
, xtics_rotate
,
ytics_rotate
, xtics_axis
, ytics_axis
, xaxis
, yaxis
,
xaxis_width
, yaxis_width
,
xaxis_type
, yaxis_type
,
xaxis_color
, yaxis_color
, xy_file
,
file_name
, pic_width
, pic_height
,
eps_width
, eps_height
,
user_preamble
, axis_bottom
, axis_left
, axis_top
and axis_right
.
To make use of this function, write first load(draw)
.
@ref{Category: Package draw}
Function gr3d
builds an object describing a 3d scene. Arguments are
graphic options and graphic objects. This scene is interpreted
sequentially: graphic options affect those graphic objects placed
on its right. Some graphic options affect the global appearence of the scene.
This is the list of graphic objects available for scenes in three dimensions:
points
, label
, vector
, explicit
, implicit
,
parametric
, parametric_surface
and geomap
.
See also the following global graphic options: xrange
, yrange
,
zrange
, logx
, logy
, logz
, terminal
,
grid
, title
, xlabel
, ylabel
, zlabel
,
xtics
, ytics
, ztics
, xtics_rotate
,
ytics_rotate
, ztics_rotate
, xtics_axis
, ytics_axis
,
ztics_axis
, xaxis
, yaxis
, zaxis
,
xaxis_width
, yaxis_width
, zaxis_width
,
xaxis_type
, yaxis_type
, zaxis_type
,
xaxis_color
, yaxis_color
, zaxis_color
, xy_file
,
user_preamble
, axis_bottom
, axis_left
,
axis_top
, file_name
, pic_width
, pic_height
,
eps_width
, eps_height
,
axis_right
, rot_vertical
, rot_horizontal
,
axis_3d
, xu_grid
, yv_grid
, surface_hide
,
contour
, contour_levels
, palette
, colorbox
and enhanced3d
.
To make use of this function, write first load(draw)
.
@ref{Category: Package draw}
Draws points in 2D and 3D.
This object is affected by the following graphic options: point_size
,
point_type
, points_joined
, line_width
, key
,
line_type
and color
.
2D
points ([[x1,y1], [x2,y2],...])
or
points ([x1,x2,...], [y1,y2,...])
plots points [x1,y1]
, [x2,y2]
, etc. If abscissas
are not given, they are set to consecutive positive integers, so that
points ([y1,y2,...])
draws points [1,y1]
, [2,y2]
, etc.
If matrix is a two-column or two-row matrix, points (matrix)
draws the associated points. If matrix is a one-column or one-row matrix,
abscissas are assigned automatically.
Example:
(%i1) load(draw)$ (%i2) draw2d( key = "Small points", points(makelist([random(20),random(50)],k,1,10)), point_type = circle, point_size = 3, points_joined = true, key = "Great points", points(makelist(k,k,1,20),makelist(random(30),k,1,20)), point_type = filled_down_triangle, key = "Automatic abscissas", color = red, points([2,12,8]))$
(%i1) load(draw)$ (%i2) draw2d( points_joined = impulses, line_width = 2, color = red, points(makelist([random(20),random(50)],k,1,10)))$
3D
points ([[x1,y1,z1], [x2,y2,z2],...])
or
points ([x1,x2,...], [y1,y2,...], [z1,z2,...])
plots points [x1,y1,z1]
, [x2,y2,z2]
, etc.
If matrix is a three-column or three-row matrix, points (matrix)
draws the associated points.
Examples:
One tridimensional sample,
(%i1) load(draw)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) draw3d(title = "Daily average wind speeds", point_size = 2, points(args(submatrix (s2, 4, 5))) )$
Two tridimensional samples,
(%i1) load(draw)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) draw3d( title = "Daily average wind speeds. Two data sets", point_size = 2, key = "Sample from stations 1, 2 and 3", points(args(submatrix (s2, 4, 5))), point_type = 4, key = "Sample from stations 1, 4 and 5", points(args(submatrix (s2, 2, 3))) )$
@ref{Category: Package draw}
Draws polygons in 2D.
2D
polygon ([[x1,y1], [x2,y2],...])
or
polygon ([x1,x2,...], [y1,y2,...])
:
plots on the plane a polygon with vertices [x1,y1]
, [x2,y2]
, etc..
This object is affected by the following graphic options: transparent
,
fill_color
, border
, line_width
, key
,
line_type
and color
.
Example:
(%i1) load(draw)$ (%i2) draw2d(color = "#e245f0", line_width = 8, polygon([[3,2],[7,2],[5,5]]), border = false, fill_color = yellow, polygon([[5,2],[9,2],[7,5]]) )$
@ref{Category: Package draw}
Draws rectangles in 2D.
2D
rectangle ([x1,y1], [x2,y2])
draws a rectangle with opposite vertices
[x1,y1]
and [x2,y2]
.
This object is affected by the following graphic options: transparent
,
fill_color
, border
, line_width
, key
,
line_type
and color
.
Example:
(%i1) load(draw)$ (%i2) draw2d(fill_color = red, line_width = 6, line_type = dots, transparent = false, fill_color = blue, rectangle([-2,-2],[8,-1]), /* opposite vertices */ transparent = true, line_type = solid, line_width = 1, rectangle([9,4],[2,-1.5]), xrange = [-3,10], yrange = [-3,4.5] )$
@ref{Category: Package draw}
Draws vertical bars in 2D.
2D
bars ([x1,h1,w1], [x2,h2,w2, ...])
draws bars centered at values x1, x2, ... with heights h1, h2, ...
and widths w1, w2, ...
This object is affected by the following graphic options: key
,
fill_color
, fill_density
and line_width
.
Example:
(%i1) load(draw)$ (%i2) draw2d( key = "Group A", fill_color = blue, fill_density = 0.2, bars([0.8,5,0.4],[1.8,7,0.4],[2.8,-4,0.4]), key = "Group B", fill_color = red, fill_density = 0.6, line_width = 4, bars([1.2,4,0.4],[2.2,-2,0.4],[3.2,5,0.4]), xaxis = true);
Draws ellipses and circles in 2D.
2D
ellipse (xc, yc, a, b, ang1, ang2)
plots an ellipse centered at [xc, yc]
with horizontal and vertical
semi axis a and b, respectively, starting at angle ang1 with an amplitude
equal to angle ang2.
This object is affected by the following graphic options: nticks
,
transparent
, fill_color
, border
, line_width
,
line_type
, key
and color
.
Example:
(%i1) load(draw)$ (%i2) draw2d(transparent = false, fill_color = red, color = gray30, transparent = false, line_width = 5, ellipse(0,6,3,2,270,-270), /* center (x,y), a, b, start & end in degrees */ transparent = true, color = blue, line_width = 3, ellipse(2.5,6,2,3,30,-90), xrange = [-3,6], yrange = [2,9] )$
@ref{Category: Package draw}
Writes labels in 2D and 3D.
Colored labels work only with Gnuplot 4.3. This is a known bug in package draw
.
This object is affected by the following graphic options: label_alignment
,
label_orientation
and color
.
2D
label([string,x,y])
writes the string at point
[x,y]
.
Example:
(%i1) load(draw)$ (%i2) draw2d(yrange = [0.1,1.4], color = "red", label(["Label in red",0,0.3]), color = "#0000ff", label(["Label in blue",0,0.6]), color = "light-blue", label(["Label in light-blue",0,0.9], ["Another light-blue",0,1.2]) )$
3D
label([string,x,y,z])
writes the string at point
[x,y,z]
.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3), color = red, label(["UP 1",-2,0,3], ["UP 2",1.5,0,4]), color = blue, label(["DOWN 1",2,0,-3]) )$
@ref{Category: Package draw}
Draws vectors in 2D and 3D.
This object is affected by the following graphic options: head_both
,
head_length
, head_angle
, head_type
, line_width
,
line_type
, key
and color
.
2D
vector([x,y], [dx,dy])
plots vector
[dx,dy]
with origin in [x,y]
.
Example:
(%i1) load(draw)$ (%i2) draw2d(xrange = [0,12], yrange = [0,10], head_length = 1, vector([0,1],[5,5]), /* default type */ head_type = 'empty, vector([3,1],[5,5]), head_both = true, head_type = 'nofilled, line_type = dots, vector([6,1],[5,5]))$
3D
vector([x,y,z], [dx,dy,dz])
plots vector [dx,dy,dz]
with
origin in [x,y,z]
.
Example:
(%i1) load(draw)$ (%i2) draw3d(color = cyan, vector([0,0,0],[1,1,1]/sqrt(3)), vector([0,0,0],[1,-1,0]/sqrt(2)), vector([0,0,0],[1,1,-2]/sqrt(6)) )$
@ref{Category: Package draw}
Draws explicit functions in 2D and 3D.
2D
explicit(fcn,var,minval,maxval)
plots explicit function fcn,
with variable var taking values from minval to maxval.
This object is affected by the following graphic options: nticks
,
adapt_depth
, line_width
, line_type
, key
,
filled_func
, fill_color
and color
.
Example:
(%i1) load(draw)$ (%i2) draw2d(line_width = 3, color = blue, explicit(x^2,x,-3,3) )$ (%i3) draw2d(fill_color = brown, filled_func = true, explicit(x^2,x,-3,3) )$
3D
explicit(fcn,var1,minval1,maxval1,var2,minval2,maxval2)
plots explicit function fcn, with variable var1 taking values
from minval1 to maxval1 and variable var2 taking values
from minval2 to maxval2.
This object is affected by the following graphic options: xu_grid
,
yv_grid
, line_type
, line_width
, key
, enhanced3d
,
meshed_surface
and color
.
Example:
(%i1) load(draw)$ (%i2) draw3d(key = "Gauss", color = "#a02c00", explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3), yv_grid = 10, color = blue, key = "Plane", explicit(x+y,x,-5,5,y,-5,5), surface_hide = true)$
See also filled_func
for filled functions.
@ref{Category: Package draw}
Draws implicit functions in 2D and 3D.
2D
implicit(fcn,x,xmin,xmax,y,ymin,ymax)
plots the implicit function defined by fcn, with variable x taking values
from xmin to xmax, and variable y taking values
from ymin to ymax.
This object is affected by the following graphic options: ip_grid
,
ip_grid_in
, line_width
, line_type
, key
and color
.
Example:
(%i1) load(draw)$ (%i2) draw2d(terminal = eps, grid = true, line_type = solid, key = "y^2=x^3-2*x+1", implicit(y^2=x^3-2*x+1, x, -4,4, y, -4,4), line_type = dots, key = "x^3+y^3 = 3*x*y^2-x-1", implicit(x^3+y^3 = 3*x*y^2-x-1, x,-4,4, y,-4,4), title = "Two implicit functions" )$
3D
implicit (fcn,x,xmin,xmax, y,ymin,ymax, z,zmin,zmax)
plots the implicit surface defined by fcn, with variable x taking values
from xmin to xmax, variable y taking values
from ymin to ymax and variable z taking values
from zmin to zmax. This object implements the marching cubes algorithm.
This object is affected by the following graphic options: x_voxel
,
y_voxel
, z_voxel
, line_width
, line_type
, key
and color
.
Example:
(%i1) load(draw)$ (%i2) draw3d( color=blue, implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015, x,-1,1,y,-1.2,2.3,z,-1,1), surface_hide=true);
@ref{Category: Package draw}
Draws 2D functions defined in polar coordinates.
2D
polar (radius,ang,minang,maxang)
plots function
radius(ang)
defined in polar coordinates, with variable
ang taking values from
minang to maxang.
This object is affected by the following graphic options: nticks
,
line_width
, line_type
, key
and color
.
Example:
(%i1) load(draw)$ (%i2) draw2d(user_preamble = "set grid polar", nticks = 200, xrange = [-5,5], yrange = [-5,5], color = blue, line_width = 3, title = "Hyperbolic Spiral", polar(10/theta,theta,1,10*%pi) )$
@ref{Category: Package draw}
Draws 3D functions defined in spherical coordinates.
3D
spherical (radius,azi,minazi,maxazi,zen,minzen,maxzen)
plots function radius(azi,zen)
defined in spherical coordinates, with azimuth
azi taking values from minazi to maxazi and zenith zen taking values from
minzen to maxzen.
This object is affected by the following graphic options: xu_grid
,
yv_grid
, line_type
, key
and color
.
Example:
(%i1) load(draw)$ (%i2) draw3d(spherical(1,a,0,2*%pi,z,0,%pi))$
@ref{Category: Package draw}
Draws 3D functions defined in cylindrical coordinates.
3D
cylindrical (radius,z,minz,maxz,azi,minazi,maxazi)
plots function radius(z,azi)
defined in cylindrical coordinates, with variable
z taking values from minz to maxz and azimuth azi taking values from
minazi to maxazi.
This object is affected by the following graphic options: xu_grid
,
yv_grid
, line_type
, key
and color
.
Example:
(%i1) load(draw)$ (%i2) draw3d(cylindrical(1,z,-2,2,az,0,2*%pi))$
@ref{Category: Package draw}
Draws parametric functions in 2D and 3D.
This object is affected by the following graphic options: nticks
,
line_width
, line_type
, key
and color
.
2D
parametric (xfun,yfun,par,parmin,parmax)
plots parametric function
[xfun,yfun]
, with parameter par taking values from
parmin to parmax.
Example:
(%i1) load(draw)$ (%i2) draw2d(explicit(exp(x),x,-1,3), color = red, key = "This is the parametric one!!", parametric(2*cos(rrr),rrr^2,rrr,0,2*%pi))$
3D
parametric (xfun,yfun,zfun,par,parmin,parmax)
plots parametric curve
[xfun,yfun,zfun]
, with parameter par taking values from
parmin to parmax.
Example:
(%i1) load(draw)$ (%i2) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3), color = royalblue, parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2), color = turquoise, line_width = 2, parametric(t^2,sin(t),2+t,t,0,2), surface_hide = true, title = "Surface & curves" )$
@ref{Category: Package draw}
Renders images in 2D.
2D
image (im,x0,y0,width,height)
plots image im in the rectangular
region from vertex (x0,y0)
to (x0+width,y0+height)
on the real
plane. Argument im must be a matrix of real numbers, a matrix of
vectors of length three or a picture object.
If im is a matrix of real numbers or a levels picture object,
pixel values are interpreted according to graphic option palette
,
which is a vector of length three with components
ranging from -36 to +36; each value is an index for a formula mapping the levels
onto red, green and blue colors, respectively:
0: 0 1: 0.5 2: 1 3: x 4: x^2 5: x^3 6: x^4 7: sqrt(x) 8: sqrt(sqrt(x)) 9: sin(90x) 10: cos(90x) 11: |x-0.5| 12: (2x-1)^2 13: sin(180x) 14: |cos(180x)| 15: sin(360x) 16: cos(360x) 17: |sin(360x)| 18: |cos(360x)| 19: |sin(720x)| 20: |cos(720x)| 21: 3x 22: 3x-1 23: 3x-2 24: |3x-1| 25: |3x-2| 26: (3x-1)/2 27: (3x-2)/2 28: |(3x-1)/2| 29: |(3x-2)/2| 30: x/0.32-0.78125 31: 2*x-0.84 32: 4x;1;-2x+1.84;x/0.08-11.5 33: |2*x - 0.5| 34: 2*x 35: 2*x - 0.5 36: 2*x - 1
negative numbers mean negative colour component.
palette = gray
and palette = color
are short cuts for
palette = [3,3,3]
and palette = [7,5,15]
, respectively.
If im is a matrix of vectors of length three or an rgb picture object, they are interpreted as red, green and blue color components.
Examples:
If im is a matrix of real numbers, pixel values are interpreted according
to graphic option palette
.
(%i1) load(draw)$ (%i2) im: apply( 'matrix, makelist(makelist(random(200),i,1,30),i,1,30))$ (%i3) /* palette = color, default */ draw2d(image(im,0,0,30,30))$ (%i4) draw2d(palette = gray, image(im,0,0,30,30))$ (%i5) draw2d(palette = [15,20,-4], colorbox=false, image(im,0,0,30,30))$
See also colorbox
.
If im is a matrix of vectors of length three, they are interpreted as red, green and blue color components.
(%i1) load(draw)$ (%i2) im: apply( 'matrix, makelist( makelist([random(300), random(300), random(300)],i,1,30),i,1,30))$ (%i3) draw2d(image(im,0,0,30,30))$
Package draw
automatically loads package picture
. In this
example, a level picture object is built by hand and then rendered.
(%i1) load(draw)$ (%i2) im: make_level_picture([45,87,2,134,204,16],3,2); (%o2) picture(level, 3, 2, {Array: #(45 87 2 134 204 16)}) (%i3) /* default color palette */ draw2d(image(im,0,0,30,30))$ (%i4) /* gray palette */ draw2d(palette = gray, image(im,0,0,30,30))$
An xpm file is read and then rendered.
(%i1) load(draw)$ (%i2) im: read_xpm("myfile.xpm")$ (%i3) draw2d(image(im,0,0,10,7))$
See also make_level_picture
, make_rgb_picture
and read_xpm
.
URL http://www.telefonica.net/web2/biomates/maxima/gpdraw/image contains more elaborated examples.
@ref{Category: Package draw}
Default value: false
boundaries_array
is where the graphic object geomap
looks
for boundaries coordinates.
Each component of boundaries_array
is an array of floating
point quantities, the coordinates of a polygonal segment or map boundary.
See also geomap
.
@ref{Category: Package draw}
Draws cartographic maps in 2D and 3D.
2D
This function works together with global variable boundaries_array
.
Argument numlist is a list containing numbers or lists of numbers.
All these numbers must be integers greater or equal than zero,
representing the components of global array boundaries_array
.
Each component of boundaries_array
is an array of floating
point quantities, the coordinates of a polygonal segment or map boundary.
geomap (numlist)
flattens its arguments and draws the
associated boundaries in boundaries_array
.
This object is affected by the following graphic options: line_width
,
line_type
and color
.
Examples:
A simple map defined by hand:
(%i1) load(draw)$ (%i2) /* Vertices of boundary #0: {(1,1),(2,5),(4,3)} */ ( bnd0: make_array(flonum,6), bnd0[0]:1.0, bnd0[1]:1.0, bnd0[2]:2.0, bnd0[3]:5.0, bnd0[4]:4.0, bnd0[5]:3.0 )$ (%i3) /* Vertices of boundary #1: {(4,3),(5,4),(6,4),(5,1)} */ ( bnd1: make_array(flonum,8), bnd1[0]:4.0, bnd1[1]:3.0, bnd1[2]:5.0, bnd1[3]:4.0, bnd1[4]:6.0, bnd1[5]:4.0, bnd1[6]:5.0, bnd1[7]:1.0)$ (%i4) /* Vertices of boundary #2: {(5,1), (3,0), (1,1)} */ ( bnd2: make_array(flonum,6), bnd2[0]:5.0, bnd2[1]:1.0, bnd2[2]:3.0, bnd2[3]:0.0, bnd2[4]:1.0, bnd2[5]:1.0 )$ (%i5) /* Vertices of boundary #3: {(1,1), (4,3)} */ ( bnd3: make_array(flonum,4), bnd3[0]:1.0, bnd3[1]:1.0, bnd3[2]:4.0, bnd3[3]:3.0)$ (%i6) /* Vertices of boundary #4: {(4,3), (5,1)} */ ( bnd4: make_array(flonum,4), bnd4[0]:4.0, bnd4[1]:3.0, bnd4[2]:5.0, bnd4[3]:1.0)$ (%i7) /* Pack all together in boundaries_array */ ( boundaries_array: make_array(any,5), boundaries_array[0]: bnd0, boundaries_array[1]: bnd1, boundaries_array[2]: bnd2, boundaries_array[3]: bnd3, boundaries_array[4]: bnd4 )$ (%i8) draw2d(geomap([0,1,2,3,4]))$
Auxiliary package worldmap
sets global variable
boundaries_array
to real world boundaries in
(longitude, latitude) coordinates. These data are in the
public domain and come from
http://www-cger.nies.go.jp/grid-e/gridtxt/grid19.html.
Package worldmap
defines also boundaries for countries,
continents and coastlines as lists with the necessary components of
boundaries_array
(see file share/draw/worldmap.mac
for more information). Package draw
does not
automatically load worldmap
.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) c1: gr2d(geomap(Canada,United_States, Mexico,Cuba))$ (%i4) c2: gr2d(geomap(Africa))$ (%i5) c3: gr2d(geomap(Oceania,China,Japan))$ (%i6) c4: gr2d(geomap(France,Portugal,Spain, Morocco,Western_Sahara))$ (%i7) draw(columns = 2, c1,c2,c3,c4)$
Package worldmap
is also useful for plotting
countries as polygons. In this case, graphic object
geomap
is no longer necessary and the polygon
object is used instead. Since lists are now used and not
arrays, maps rendering will be slower. See also make_poly_country
and make_poly_continent
to understand the following code.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) mymap: append( [color = white], /* borders are white */ [fill_color = red], make_poly_country(Bolivia), [fill_color = cyan], make_poly_country(Paraguay), [fill_color = green], make_poly_country(Colombia), [fill_color = blue], make_poly_country(Chile), [fill_color = "#23ab0f"], make_poly_country(Brazil), [fill_color = goldenrod], make_poly_country(Argentina), [fill_color = "midnight-blue"], make_poly_country(Uruguay))$ (%i4) apply(draw2d, mymap)$
3D
geomap (numlist)
projects map boundaries on the sphere of radius 1
centered at (0,0,0). It is possible to change the sphere or the projection type
by using geomap (numlist,3Dprojection)
.
Available 3D projections:
[spherical_projection,x,y,z,r]
: projects map boundaries on the sphere of
radius r centered at (x,y,z).
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) draw3d(geomap(Australia), /* default projection */ geomap(Australia, [spherical_projection,2,2,2,3]))$
[cylindrical_projection,x,y,z,r,rc]
: re-projects spherical map boundaries on the cylinder of radius
rc and axis passing through the poles of the globe of radius r centered at (x,y,z).
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) draw3d(geomap([America_coastlines,Eurasia_coastlines], [cylindrical_projection,2,2,2,3,4]))$
[conic_projection,x,y,z,r,alpha]
: re-projects spherical map boundaries on the cones of angle alpha,
with axis passing through the poles of the globe of radius r centered at (x,y,z). Both
the northern and southern cones are tangent to sphere.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) draw3d(geomap(World_coastlines, [conic_projection,0,0,0,1,90]))$
See also http://www.telefonica.net/web2/biomates/maxima/gpdraw/geomap for more elaborated examples.
@ref{Category: Package draw}
Draws parametric surfaces in 3D.
3D
parametric_surface (xfun,yfun,zfun,par1,par1min,par1max,par2,par2min,par2max)
plots parametric surface [xfun,yfun,zfun]
, with parameter par1
taking values from par1min to par1max and parameter par2
taking values from par2min to par2max.
This object is affected by the following graphic options: xu_grid
,
yv_grid
, line_type
, line_width
, key
, enhanced3d
,
meshed_surface
and color
.
Example:
(%i1) load(draw)$ (%i2) draw3d(title = "Sea shell", xu_grid = 100, yv_grid = 25, rot_vertical = 100, rot_horizontal = 20, surface_hide = true, parametric_surface(0.5*u*cos(u)*(cos(v)+1), 0.5*u*sin(u)*(cos(v)+1), u*sin(v) - ((u+3)/8*%pi)^2 - 20, u, 0, 13*%pi, v, -%pi, %pi) )$
@ref{Category: Package draw}
Plots a series of scenes; its arguments are gr2d
and/or gr3d
objects, together with some options. By default, the scenes are put together
in one column.
Function draw
accepts the following global options: terminal
,
columns
, pic_width
, pic_height
, eps_width
,
eps_height
, file_name
and delay
.
Functions draw2d
and draw3d
are short cuts to be used
when only one scene is required, in two or three dimensions, respectively.
To make use of this function, write first load(draw)
.
Example:
(%i1) load(draw)$ (%i2) scene1: gr2d(title="Ellipse", nticks=30, parametric(2*cos(t),5*sin(t),t,0,2*%pi))$ (%i3) scene2: gr2d(title="Triangle", polygon([4,5,7],[6,4,2]))$ (%i4) draw(scene1, scene2, columns = 2)$
The two draw sentences are equivalent:
(%i1) load(draw)$ (%i2) draw(gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1))); (%o2) [gr3d(explicit)] (%i3) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1)); (%o3) [gr3d(explicit)]
An animated gif file:
(%i1) load(draw)$ (%i2) draw( delay = 100, file_name = "zzz", terminal = 'animated_gif, gr2d(explicit(x^2,x,-1,1)), gr2d(explicit(x^3,x,-1,1)), gr2d(explicit(x^4,x,-1,1))); End of animation sequence (%o2) [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
See also gr2d
, gr3d
, draw2d
and draw3d
..
@ref{Category: Package draw} · @ref{Category: File output}
This function is a short cut for
draw(gr2d(options, ..., graphic_object, ...))
.
It can be used to plot a unique scene in 2d.
To make use of this function, write first load(draw)
.
See also draw
and gr2d
.
@ref{Category: Package draw} · @ref{Category: File output}
This function is a short cut for
draw(gr3d(options, ..., graphic_object, ...))
.
It can be used to plot a unique scene in 3d.
To make use of this function, write first load(draw)
.
See also draw
and gr3d
.
@ref{Category: Package draw} · @ref{Category: File output}
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Returns a levels picture object. make_level_picture (data)
builds the picture object from matrix data.
make_level_picture (data,width,height)
builds the object from a list of numbers; in this case, both the
width and the height must be given.
The returned picture object contains the following four parts:
level
Example:
Level picture from matrix.
(%i1) load(draw)$ (%i2) make_level_picture(matrix([3,2,5],[7,-9,3000])); (%o2) picture(level, 3, 2, {Array: #(3 2 5 7 0 255)})
Level picture from numeric list.
(%i1) load(draw)$ (%i2) make_level_picture([-2,0,54,%pi],2,2); (%o2) picture(level, 2, 2, {Array: #(0 0 54 3)})
@ref{Category: Package draw}
Returns true
if the argument is a well formed image,
and false
otherwise.
@ref{Category: Package draw} · @ref{Category: Predicate functions}
Returns true
in case of equal pictures, and false
otherwise.
@ref{Category: Package draw} · @ref{Category: Predicate functions}
Returns an rgb-coloured picture object. All three arguments must be levels picture; with red, green and blue levels.
The returned picture object contains the following four parts:
rgb
Example:
(%i1) load(draw)$ (%i2) red: make_level_picture(matrix([3,2],[7,260])); (%o2) picture(level, 2, 2, {Array: #(3 2 7 255)}) (%i3) green: make_level_picture(matrix([54,23],[73,-9])); (%o3) picture(level, 2, 2, {Array: #(54 23 73 0)}) (%i4) blue: make_level_picture(matrix([123,82],[45,32.5698])); (%o4) picture(level, 2, 2, {Array: #(123 82 45 33)}) (%i5) make_rgb_picture(red,green,blue); (%o5) picture(rgb, 2, 2, {Array: #(3 54 123 2 23 82 7 73 45 255 0 33)})
@ref{Category: Package draw}
If argument color is red
, green
or blue
,
function take_channel
returns the corresponding color channel of
picture im.
Example:
(%i1) load(draw)$ (%i2) red: make_level_picture(matrix([3,2],[7,260])); (%o2) picture(level, 2, 2, {Array: #(3 2 7 255)}) (%i3) green: make_level_picture(matrix([54,23],[73,-9])); (%o3) picture(level, 2, 2, {Array: #(54 23 73 0)}) (%i4) blue: make_level_picture(matrix([123,82],[45,32.5698])); (%o4) picture(level, 2, 2, {Array: #(123 82 45 33)}) (%i5) make_rgb_picture(red,green,blue); (%o5) picture(rgb, 2, 2, {Array: #(3 54 123 2 23 82 7 73 45 255 0 33)}) (%i6) take_channel(%,'green); /* simple quote!!! */ (%o6) picture(level, 2, 2, {Array: #(54 23 73 0)})
@ref{Category: Package draw}
Returns the negative of a (level or rgb) picture.
@ref{Category: Package draw}
Transforms an rgb picture into a level one by averaging the red, green and blue channels.
@ref{Category: Package draw}
Returns pixel from picture. Coordinates x and y range from 0 to
width-1
and height-1
, respectively.
@ref{Category: Package draw}
Reads a file in xpm and returns a picture object.
@ref{Category: Package draw}
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Detects polygonal segments of global variable boundaries_array
contained in the rectangle with vertices (x1,y1) -upper left-
and (x2,y2) -bottom right-.
Example:
Returns segment numbers for plotting southern Italy.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) region_boundaries(10.4,41.5,20.7,35.4); (%o3) [1846, 1863, 1864, 1881, 1888, 1894] (%i4) draw2d(geomap(%))$
@ref{Category: Package draw}
Draws a list of polygonal segments (boundaries), labeled by
its numbers (boundaries_array
coordinates). This is of great
help when building new geographical entities.
Example:
Map of Europe labeling borders with their component number in
boundaries_array
.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) european_borders: region_boundaries(-31.81,74.92,49.84,32.06)$ (%i4) numbered_boundaries(european_borders)$
@ref{Category: Package draw}
Returns a polygon
object from boundary indices. Argument
nlist is a list of components of boundaries_array
.
Example:
Bhutan is defined by boundary numbers 171, 173
and 1143, so that make_polygon([171,173,1143])
appends arrays of coordinates boundaries_array[171]
,
boundaries_array[173]
and boundaries_array[1143]
and
returns a polygon
object suited to be plotted by
draw
. To avoid an error message, arrays must be
compatible in the sense that any two consecutive
arrays have two coordinates in the extremes in common. In this
example, the two first components of boundaries_array[171]
are
equal to the last two coordinates of boundaries_array[173]
, and
the two first of boundaries_array[173]
are equal to the two first
of boundaries_array[1143]
; in conclussion, boundary numbers
171, 173 and 1143 (in this order) are compatible and the colored
polygon can be drawn.
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) Bhutan; (%o3) [[171, 173, 1143]] (%i4) boundaries_array[171]; (%o4) {Array: #(88.750549 27.14727 88.806351 27.25305 88.901367 27.282221 88.917877 27.321039)} (%i5) boundaries_array[173]; (%o5) {Array: #(91.659554 27.76511 91.6008 27.66666 91.598022 27.62499 91.631348 27.536381 91.765533 27.45694 91.775253 27.4161 92.007751 27.471939 92.11441 27.28583 92.015259 27.168051 92.015533 27.08083 92.083313 27.02277 92.112183 26.920271 92.069977 26.86194 91.997192 26.85194 91.915253 26.893881 91.916924 26.85416 91.8358 26.863331 91.712479 26.799999 91.542191 26.80444 91.492188 26.87472 91.418854 26.873329 91.371353 26.800831 91.307457 26.778049 90.682457 26.77417 90.392197 26.903601 90.344131 26.894159 90.143044 26.75333 89.98996 26.73583 89.841919 26.70138 89.618301 26.72694 89.636093 26.771111 89.360786 26.859989 89.22081 26.81472 89.110237 26.829161 88.921631 26.98777 88.873016 26.95499 88.867737 27.080549 88.843307 27.108601 88.750549 27.14727)} (%i6) boundaries_array[1143]; (%o6) {Array: #(91.659554 27.76511 91.666924 27.88888 91.65831 27.94805 91.338028 28.05249 91.314972 28.096661 91.108856 27.971109 91.015808 27.97777 90.896927 28.05055 90.382462 28.07972 90.396088 28.23555 90.366074 28.257771 89.996353 28.32333 89.83165 28.24888 89.58609 28.139999 89.35997 27.87166 89.225517 27.795 89.125793 27.56749 88.971077 27.47361 88.917877 27.321039)} (%i7) Bhutan_polygon: make_polygon([171,173,1143])$ (%i8) draw2d(Bhutan_polygon)$
@ref{Category: Package draw}
Makes the necessary polygons to draw a colored country. If islands exist, one country can be defined with more than just one polygon.
Example:
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) make_poly_country(India)$ (%i4) apply(draw2d, %)$
@ref{Category: Package draw}
Makes the necessary polygons to draw a colored continent or a list of countries.
Example:
(%i1) load(draw)$ (%i2) load(worldmap)$ (%i3) /* A continent */ make_poly_continent(Africa)$ (%i4) apply(draw2d, %)$ (%i5) /* A list of countries */ make_poly_continent([Germany,Denmark,Poland])$ (%i6) apply(draw2d, %)$
@ref{Category: Package draw}
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated by root on July, 13 2009 using texi2html 1.76.