2 * Introduction to draw::
3 * Functions and Variables for draw::
4 * Functions and Variables for pictures::
5 * Functions and Variables for worldmap::
8 @node Introduction to draw, Functions and Variables for draw, Package draw, Package draw
9 @section Introduction to draw
11 @code{draw} is a Maxima-Gnuplot and a Maxima-VTK interface.
13 There are three main functions to be used at Maxima level:
15 @item @mrefcomma{draw2d} draws a single 2D scene.
16 @item @mrefcomma{draw3d} draws a single 3D scene.
17 @item @mrefcomma{draw} can be filled with multiple @mref{gr2d} and @mref{gr3d}
18 commands that each creates a draw scene all sharing the same window.
20 Each scene can contain any number of objects and @code{key=value} pairs
21 with options for the scene or the following objects.
23 A selection of useful objects a scene can be made up from are:
25 @item @mref{explicit} plots a function.
26 @item @mref{implicit} plots all points an equation is true at.
27 @item @mref{points} plots points that are connected by lines if the option
28 @mref{points_joined} was set to @code{true} in a previous line of the
30 @item @mref{parametric} allows to specify separate expressions that calculate
31 the x, y (and in 3d plots also for the z) variable.
34 A short description of all draw commands and options including example plots
35 (in the html and pdf version of this manual) can be found in the section
36 @xref{Functions and Variables for draw}. An online version of the html manual can be
37 found at @url{https://maxima.sourceforge.io/docs/manual/maxima_singlepage.html#draw}.
38 More elaborated examples of this package can be found at the following locations:
40 @url{http://riotorto.users.sourceforge.net/Maxima/gnuplot/} @*
41 @url{http://riotorto.users.sourceforge.net/Maxima/vtk/}
47 title="Two simple plots",
48 xlabel="x",ylabel="y",grid=true,
50 color=red,key="A sinus",
51 explicit(sin(x),x,1,10),
52 color=blue,line_type=dots,key="A cosinus",
53 explicit(cos(x),x,1,10)
58 You need Gnuplot 4.2 or newer to run draw; If you are using wxMaxima as a
59 front end @code{wxdraw}, @code{wxdraw2d} and @code{wxdraw3d} are drop-in
60 replacements for draw that do the same as @mrefcomma{draw} @mref{draw2d} and
61 @mref{draw3d} but embed the resulting plot in the worksheet.
63 If you want to use VTK with draw, you need VTK with the Python interface installed
64 (the @ref{Package dynamics} uses VTK with the TCL interface!) and set the variable:
66 @code{draw_renderer: 'vtk $}
68 @opencatbox{Categories:}
70 @category{Share packages}
71 @category{Package draw}
75 @node Functions and Variables for draw, Functions and Variables for pictures, Introduction to draw, Package draw
76 @section Functions and Variables for draw
85 @deffn {Scene constructor} gr2d (@var{argument_1}, ...)
87 Function @code{gr2d} builds an object describing a 2D scene. Arguments are
88 @i{graphic options}, @i{graphic objects}, or lists containing both graphic options and objects.
89 This scene is interpreted sequentially: @i{graphic options} affect those @i{graphic objects}
90 placed on its right. Some @i{graphic options} affect the global appearance of the scene.
92 This is the list of @i{graphic objects} available for scenes in two dimensions:
93 @mrefcomma{bars} @mrefcomma{ellipse} @mrefcomma{explicit} @mrefcomma{image} @mrefcomma{implicit} @mrefcomma{label}
94 @mrefcomma{parametric} @mrefcomma{points} @mrefcomma{polar} @mrefcomma{polygon} @mrefcomma{quadrilateral}
95 @mrefcomma{rectangle} @mrefcomma{triangle} @mref{vector} and @code{geomap}
96 (this one defined in package @code{worldmap}).
104 @c key="sin (x)",grid=[2,2],
111 @c key="cos (x)",grid=[2,2],
122 key="sin (x)",grid=[2,2],
129 key="cos (x)",grid=[2,2],
136 (%o1) [gr2d(explicit), gr2d(explicit)]
141 @opencatbox{Categories:}
142 @category{Package draw}
149 @deffn {Scene constructor} gr3d (@var{argument_1}, ...)
151 Function @code{gr3d} builds an object describing a 3d scene. Arguments are
152 @i{graphic options}, @i{graphic objects}, or lists containing both graphic options
153 and objects. This scene is interpreted sequentially: @i{graphic options} affect those
154 @i{graphic objects} placed on its right. Some @i{graphic options} affect the global
155 appearance of the scene.
157 This is the list of @i{graphic objects} available for scenes in three
159 @mrefcomma{cylindrical} @mrefcomma{elevation_grid} @mrefcomma{explicit} @mrefcomma{implicit}
160 @mrefcomma{label} @mrefcomma{mesh} @mrefcomma{parametric}@*
161 @mrefcomma{parametric_surface} @mrefcomma{points} @mrefcomma{quadrilateral}
162 @mrefcomma{spherical} @mrefcomma{triangle} @mrefcomma{tube}@*
163 @mrefcomma{vector} and @mref{geomap} (this one defined in package @code{worldmap}).
165 See also @mref{draw} and @mrefdot{draw3d}
167 @opencatbox{Categories:}
168 @category{Package draw}
176 @subsection Functions
181 @deffn {Function} draw (@code{<arg_1>, ...})
183 Plots a series of scenes; its arguments are @code{gr2d} and/or @code{gr3d}
184 objects, together with some options, or lists of scenes and options.
185 By default, the scenes are put together
188 Besides scenes the function @code{draw} accepts the following global options:
189 @mrefcomma{terminal} @mrefcomma{columns} @mrefcomma{dimensions} @mref{file_name}
192 Functions @mref{draw2d} and @mref{draw3d} short cuts that can be used
193 when only one scene is required, in two or three dimensions, respectively.
195 See also @mref{gr2d} and @mrefdot{gr3d}
200 (%i1) scene1: gr2d(title="Ellipse",
202 parametric(2*cos(t),5*sin(t),t,0,2*%pi))$
203 (%i2) scene2: gr2d(title="Triangle",
204 polygon([4,5,7],[6,4,2]))$
205 (%i3) draw(scene1, scene2, columns = 2)$
210 (%i1) scene1: gr2d(title="A sinus",
212 explicit(sin(t),t,0,2*%pi))$
213 (%i2) scene2: gr2d(title="A cosinus",
215 explicit(cos(t),t,0,2*%pi))$
216 (%i3) draw(scene1, scene2)$
220 The following two draw sentences are equivalent:
222 (%i1) draw(gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1)));
223 (%o1) [gr3d(explicit)]
224 (%i2) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1));
225 (%o2) [gr3d(explicit)]
228 Creating an animated gif file:
233 terminal = 'animated_gif,
234 gr2d(explicit(x^2,x,-1,1)),
235 gr2d(explicit(x^3,x,-1,1)),
236 gr2d(explicit(x^4,x,-1,1)));
237 End of animation sequence
238 (%o1) [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
241 See also @mrefcomma{gr2d} @mrefcomma{gr3d} @mref{draw2d} and @mrefdot{draw3d}
243 @opencatbox{Categories:}
244 @category{Package draw}
245 @category{File output}
254 @deffn {Function} draw2d (@var{argument_1}, ...)
256 This function is a shortcut for
257 @code{draw(gr2d(@var{options}, ..., @var{graphic_object}, ...))}.
259 It can be used to plot a unique scene in 2d, as can be seen in most examples below.
261 See also @mref{draw} and @mrefdot{gr2d}
263 @opencatbox{Categories:}
264 @category{Package draw}
265 @category{File output}
275 @deffn {Function} draw3d (@var{argument_1}, ...)
277 This function is a shortcut for
278 @code{draw(gr3d(@var{options}, ..., @var{graphic_object}, ...))}.
280 It can be used to plot a unique scene in 3d, as can be seen in many examples below.
282 See also @mref{draw} and @mrefdot{gr3d}
284 @opencatbox{Categories:}
285 @category{Package draw}
286 @category{File output}
293 @deffn {Function} draw_file (@var{graphic option}, ..., @var{graphic object}, ...)
295 Saves the current plot into a file. Accepted graphics options are:
296 @code{terminal}, @code{dimensions} and @code{file_name}.
301 (%i1) /* screen plot */
302 draw(gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1)))$
303 (%i2) /* same plot in eps format */
304 draw_file(terminal = eps,
305 dimensions = [5,5]) $
308 @opencatbox{Categories:}
309 @category{Package draw}
310 @category{File output}
316 @anchor{multiplot_mode}
317 @deffn {Function} multiplot_mode (@var{term})
319 This function enables Maxima to work in one-window multiplot mode with terminal
320 @var{term}; accepted arguments for this function are @code{screen},
321 @code{wxt}, @code{aquaterm}, @code{windows} and @code{none}.
323 When multiplot mode is enabled, each call to @code{draw} sends a new plot to the
324 same window, without erasing the previous ones. To disable the multiplot mode,
325 write @code{multiplot_mode(none)}.
327 When multiplot mode is enabled, global option @code{terminal} is blocked and you
328 have to disable this working mode before changing to another terminal.
330 On Windows this feature requires Gnuplot 5.0 or newer.
331 Note, that just plotting multiple expressions into the same plot doesn't require
332 multiplot: It can be done by just issuing multiple @mref{explicit} or similar
338 (%i1) set_draw_defaults(
342 title = "Step by step plot" )$
343 (%i2) multiplot_mode(screen)$
344 (%i3) draw2d(color=blue, explicit(x^2,x,-1,1))$
345 (%i4) draw2d(color=red, explicit(x^3,x,-1,1))$
346 (%i5) draw2d(color=brown, explicit(x^4,x,-1,1))$
347 (%i6) multiplot_mode(none)$
349 @figure{draw_multiplot}
351 @opencatbox{Categories:}
352 @category{Package draw}
353 @category{File output}
361 @anchor{set_draw_defaults}
362 @deffn {Function} set_draw_defaults (@var{graphic option}, ..., @var{graphic object}, ...)
364 Sets user graphics options. This function is useful for plotting a sequence
365 of graphics with common graphics options. Calling this function without
366 arguments removes user defaults.
371 (%i1) set_draw_defaults(
376 (%i2) /* plot with user defaults */
377 draw2d(explicit(((1+x)**2/(1+x*x))-1,x,-10,10))$
378 (%i3) set_draw_defaults()$
379 (%i4) /* plot with standard defaults */
380 draw2d(explicit(((1+x)**2/(1+x*x))-1,x,-10,10))$
383 @opencatbox{Categories:}
384 @category{Package draw}
389 @subsection Plot options for draw programs
391 @anchor{adapt_depth_draw}
392 @defvr {Graphic option} adapt_depth
395 @code{adapt_depth} is the maximum number of splittings used by the adaptive plotting routine.
397 This option is relevant only for 2d @code{explicit} functions.
399 See also @code{nticks}
401 @opencatbox{Categories:}
402 @category{Package draw}
408 @defvr {Graphic option} allocation
409 Default value: @code{false}
411 With option @code{allocation} it is possible to place a scene in the
412 output window at will; this is of interest in multiplots. When @code{false},
413 the scene is placed automatically, depending on the value assigned to option
414 @code{columns}. In any other case, @code{allocation} must be set to a list of
415 two pairs of numbers; the first corresponds to the position of the lower left
416 corner of the scene, and the second pair gives the width and height of the plot.
417 All quantities must be given in relative coordinates, between 0 and 1.
426 explicit(x^2,x,-1,1)),
428 allocation = [[1/4, 1/4],[1/2, 1/2]],
429 explicit(x^3,x,-1,1),
432 @figure{draw_allocation}
434 Multiplot with selected dimensions.
441 allocation = [[0, 0],[1, 1/4]],
442 explicit(x^2,x,-1,1)),
444 allocation = [[0, 1/4],[1, 3/4]],
445 explicit(x^2+y^2,x,-1,1,y,-1,1) ))$
447 @figure{draw_allocation2}
449 See also option @mrefdot{columns}
451 @opencatbox{Categories:}
452 @category{Package draw}
459 @defvr {Graphic option} axis_3d
460 Default value: @code{true}
462 If @code{axis_3d} is @code{true}, the @var{x}, @var{y} and @var{z} axis are shown in 3d scenes.
464 Since this is a global graphics option, its position in the scene description
470 (%i1) draw3d(axis_3d = false,
471 explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
475 See also @mrefcomma{axis_bottom} @mrefcomma{axis_left} @mrefcomma{axis_top} and @mref{axis_right} for axis in 2d.
477 @opencatbox{Categories:}
478 @category{Package draw}
486 @defvr {Graphic option} axis_bottom
487 Default value: @code{true}
489 If @code{axis_bottom} is @code{true}, the bottom axis is shown in 2d scenes.
491 Since this is a global graphics option, its position in the scene description
497 (%i1) draw2d(axis_bottom = false,
498 explicit(x^3,x,-1,1))$
500 @figure{draw_axis_bottom}
502 See also @mrefcomma{axis_left} @mrefcomma{axis_top} @mref{axis_right} and @mrefdot{axis_3d}
504 @opencatbox{Categories:}
505 @category{Package draw}
513 @defvr {Graphic option} axis_left
514 Default value: @code{true}
516 If @code{axis_left} is @code{true}, the left axis is shown in 2d scenes.
518 Since this is a global graphics option, its position in the scene description
524 (%i1) draw2d(axis_left = false,
525 explicit(x^3,x,-1,1))$
528 See also @mrefcomma{axis_bottom} @mrefcomma{axis_top} @mref{axis_right} and @mrefdot{axis_3d}
530 @opencatbox{Categories:}
531 @category{Package draw}
539 @defvr {Graphic option} axis_right
540 Default value: @code{true}
542 If @code{axis_right} is @code{true}, the right axis is shown in 2d scenes.
544 Since this is a global graphics option, its position in the scene description
550 (%i1) draw2d(axis_right = false,
551 explicit(x^3,x,-1,1))$
554 See also @mrefcomma{axis_bottom} @mrefcomma{axis_left} @mref{axis_top} and @mrefdot{axis_3d}
556 @opencatbox{Categories:}
557 @category{Package draw}
565 @defvr {Graphic option} axis_top
566 Default value: @code{true}
568 If @code{axis_top} is @code{true}, the top axis is shown in 2d scenes.
570 Since this is a global graphics option, its position in the scene description
576 (%i1) draw2d(axis_top = false,
577 explicit(x^3,x,-1,1))$
580 See also @mrefcomma{axis_bottom} @mrefcomma{axis_left} @mrefcomma{axis_right} and @mrefdot{axis_3d}
582 @opencatbox{Categories:}
583 @category{Package draw}
590 @anchor{background_color}
591 @defvr {Graphic option} background_color
592 Default value: @code{white}
594 Sets the background color for terminals. Default background color is white.
596 Since this is a global graphics option, its position in the scene description
599 This option does not work with terminals @code{epslatex} and @code{epslatex_standalone}.
601 See also @code{color}
603 @opencatbox{Categories:}
604 @category{Package draw}
612 @defvr {Graphic option} border
613 Default value: @code{true}
615 If @code{border} is @code{true}, borders of polygons are painted
616 according to @code{line_type} and @code{line_width}.
618 This option affects the following graphic objects:
622 @code{gr2d}: @mrefcomma{polygon} @mref{rectangle} and @mrefdot{ellipse}
628 (%i1) draw2d(color = brown,
630 polygon([[3,2],[7,2],[5,5]]),
633 polygon([[5,2],[9,2],[7,5]]) )$
637 @opencatbox{Categories:}
638 @category{Package draw}
646 @defvr {Graphic option} capping
647 Default value: @code{[false, false]}
649 A list with two possible elements, @code{true} and @code{false},
650 indicating whether the extremes of a graphic object @code{tube} remain closed
651 or open. By default, both extremes are left open.
653 Setting @code{capping = false} is equivalent to @code{capping = [false, false]},
654 and @code{capping = true} is equivalent to @code{capping = [true, true]}.
660 capping = [false, true],
664 @figure{draw_tube_extremes}
666 @opencatbox{Categories:}
667 @category{Package draw}
675 @defvr {Graphic option} cbrange
676 Default value: @code{auto}
678 If @code{cbrange} is @code{auto}, the range for the values which are
679 colored when @code{enhanced3d} is not @code{false} is computed
680 automatically. Values outside of the color range use color of the
683 When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{cbrange} has
686 If the user wants a specific interval for the colored values, it must
687 be given as a Maxima list, as in @code{cbrange=[-2, 3]}.
689 Since this is a global graphics option, its position in the scene description
699 explicit(x^2+y^2, x,-2,2,y,-2,2)) $
701 @figure{draw_cbrange}
703 See also @mrefcomma{enhanced3d} @mref{colorbox} and @mrefdot{cbtics}
705 @opencatbox{Categories:}
706 @category{Package draw}
713 @defvr {Graphic option} cbtics
714 Default value: @code{auto}
716 This graphic option controls the way tic marks are drawn on the colorbox
717 when option @code{enhanced3d} is not @code{false}.
719 When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{cbtics} has
722 See @code{xtics} for a complete description.
730 cbtics = @{["High",10],["Medium",05],["Low",0]@},
732 explicit(x^2+y^2, x,-2,2,y,-2,2)) $
736 See also @mrefcomma{enhanced3d} @mref{colorbox} and @mrefdot{cbrange}
738 @opencatbox{Categories:}
739 @category{Package draw}
745 @defvr {Graphic option} color
746 Default value: @code{blue}
748 @code{color} specifies the color for plotting lines, points, borders of
751 Colors can be given as names or in hexadecimal @i{rgb} code. If a gnuplot
752 version @code{>= 5.0} is used and the terminal that is in use supports this
753 @i{rgba} colors with transparency information are also supported.
755 Available color names are:
757 white black gray0 grey0
758 gray10 grey10 gray20 grey20
759 gray30 grey30 gray40 grey40
760 gray50 grey50 gray60 grey60
761 gray70 grey70 gray80 grey80
762 gray90 grey90 gray100 grey100
763 gray grey light_gray light_grey
764 dark_gray dark_grey red light_red
765 dark_red yellow light_yellow dark_yellow
766 green light_green dark_green spring_green
767 forest_green sea_green blue light_blue
768 dark_blue midnight_blue navy medium_blue
769 royalblue skyblue cyan light_cyan
770 dark_cyan magenta light_magenta dark_magenta
771 turquoise light_turquoise dark_turquoise pink
772 light_pink dark_pink coral light_coral
773 orange_red salmon light_salmon dark_salmon
774 aquamarine khaki dark_khaki goldenrod
775 light_goldenrod dark_goldenrod gold beige
776 brown orange dark_orange violet
777 dark_violet plum purple
780 Cromatic components in hexadecimal code are introduced in the form @code{"#rrggbb"}.
785 (%i1) draw2d(explicit(x^2,x,-1,1), /* default is black */
787 explicit(0.5 + x^2,x,-1,1),
789 explicit(1 + x^2,x,-1,1),
791 explicit(1.5 + x^2,x,-1,1),
793 label(["This is a label",0,1.2]) )$
800 explicit(sin(x),x,0,10),
802 explicit(cos(x),x,0,10)
808 (%i1) H(p,p_0) := %i/(2*%pi*(p-p_0))$
810 proportional_axes=xy,
815 color=printf(false,"#~2,'0x~2,'0x~2,'0x",i*10,0,0),
817 key = if mod(i,5)=0 then sconcat("H=",i,"A/M") else "",
819 cabs(H(x+%i*y,-1-%i)+H(x+%i*y,1+%i)-H(x+%i*y,1-%i)
820 -H(x+%i*y,-1+%i))=i/10,
833 "figures/draw_color4",
837 key=sconcat("color =",i),
838 explicit(sin(i*x),x,0,1)
847 See also @mrefdot{fill_color}
849 @opencatbox{Categories:}
850 @category{Package draw}
858 @defvr {Graphic option} colorbox
859 Default value: @code{true}
861 If @code{colorbox} is @code{true}, a color scale without label is drawn together with
862 @code{image} 2D objects, or coloured 3d objects. If @code{colorbox} is @code{false}, no
863 color scale is shown. If @code{colorbox} is a string, a color scale with label is drawn.
865 Since this is a global graphics option, its position in the scene description
870 Color scale and images.
873 (%i1) im: apply('matrix,
874 makelist(makelist(random(200),i,1,30),i,1,30))$
876 gr2d(image(im,0,0,30,30)),
877 gr2d(colorbox = false, image(im,0,0,30,30))
880 @figure{draw_colorbox}
881 Color scale and 3D coloured object.
885 colorbox = "Magnitude",
887 explicit(x^2+y^2,x,-1,1,y,-1,1))$
889 @figure{draw_colorbox2}
891 See also @mrefdot{palette_draw}
893 @opencatbox{Categories:}
894 @category{Package draw}
903 @defvr {Graphic option} columns
906 @code{columns} is the number of columns in multiple plots.
908 Since this is a global graphics option, its position in the scene description
909 does not matter. It can be also used as an argument of function @code{draw}.
914 (%i1) scene1: gr2d(title="Ellipse",
916 parametric(2*cos(t),5*sin(t),t,0,2*%pi))$
917 (%i2) scene2: gr2d(title="Triangle",
918 polygon([4,5,7],[6,4,2]))$
919 (%i3) draw(scene1, scene2, columns = 2)$
921 @figure{draw_columns}
923 @opencatbox{Categories:}
924 @category{Package draw}
932 @defvr {Graphic option} contour
933 Default value: @code{none}
935 Option @code{contour} enables the user to select where to plot contour lines.
942 no contour lines are plotted.
946 contour lines are projected on the xy plane.
950 contour lines are plotted on the surface.
954 two contour lines are plotted: on the xy plane and on the surface.
958 contour lines are projected on the xy plane, and the view point is
959 set just in the vertical.
963 Since this is a global graphics option, its position in the scene description
969 (%i1) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
972 surface_hide = true) $
974 @figure{draw_contour}
977 (%i1) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
982 @figure{draw_contour2}
984 @opencatbox{Categories:}
985 @category{Package draw}
992 @anchor{contour_levels}
993 @defvr {Graphic option} contour_levels
996 This graphic option controls the way contours are drawn.
997 @code{contour_levels} can be set to a positive integer number, a list of three
998 numbers or an arbitrary set of numbers:
1002 When option @code{contour_levels} is bounded to positive integer @var{n},
1003 @var{n} contour lines will be drawn at equal intervals. By default, five
1004 equally spaced contours are plotted.
1007 When option @code{contour_levels} is bounded to a list of length three of the
1008 form @code{[lowest,s,highest]}, contour lines are plotted from @code{lowest}
1009 to @code{highest} in steps of @code{s}.
1012 When option @code{contour_levels} is bounded to a set of numbers of the
1013 form @code{@{n1, n2, ...@}}, contour lines are plotted at values @code{n1},
1017 Since this is a global graphics option, its position in the scene description
1022 Ten equally spaced contour lines. The actual number of
1023 levels can be adjusted to give simple labels.
1025 (%i1) draw3d(color = green,
1026 explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
1027 contour_levels = 10,
1029 surface_hide = true) $
1033 From -8 to 8 in steps of 4.
1035 (%i1) draw3d(color = green,
1036 explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
1037 contour_levels = [-8,4,8],
1039 surface_hide = true) $
1042 Isolines at levels -7, -6, 0.8 and 5.
1044 (%i1) draw3d(color = green,
1045 explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
1046 contour_levels = @{-7, -6, 0.8, 5@},
1048 surface_hide = true) $
1051 See also @mrefdot{contour}
1053 @opencatbox{Categories:}
1054 @category{Package draw}
1061 @anchor{data_file_name}
1062 @defvr {Graphic option} data_file_name
1063 Default value: @code{"data.gnuplot"}
1065 This is the name of the file with the numeric data needed
1066 by Gnuplot to build the requested plot.
1068 Since this is a global graphics option, its position in the scene description
1069 does not matter. It can be also used as an argument of function @code{draw}.
1071 See example in @code{gnuplot_file_name}.
1073 @opencatbox{Categories:}
1074 @category{Package draw}
1082 @defvr {Graphic option} delay
1085 This is the delay in 1/100 seconds of frames in animated gif files.
1087 Since this is a global graphics option, its position in the scene description
1088 does not matter. It can be also used as an argument of function @code{draw}.
1096 terminal = 'animated_gif,
1097 gr2d(explicit(x^2,x,-1,1)),
1098 gr2d(explicit(x^3,x,-1,1)),
1099 gr2d(explicit(x^4,x,-1,1)));
1100 End of animation sequence
1101 (%o2) [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
1104 Option @code{delay} is only active in animated gif's; it is ignored in
1107 See also @mrefcomma{terminal} and @code{dimensions}.
1109 @opencatbox{Categories:}
1110 @category{Package draw}
1117 @anchor{dimensions_draw}
1118 @defvr {Graphic option} dimensions
1119 Default value: @code{[600,500]}
1121 Dimensions of the output terminal. Its value is a list formed by
1122 the width and the height. The meaning of the two numbers depends on
1123 the terminal you are working with.
1125 With terminals @code{gif}, @code{animated_gif}, @code{png}, @code{jpg},
1126 @code{svg}, @code{screen}, @code{wxt}, and @code{aquaterm},
1127 the integers represent the number of points in each direction. If they
1128 are not integers, they are rounded.
1130 With terminals @code{eps}, @code{eps_color}, @code{pdf}, and
1131 @code{pdfcairo}, both numbers represent hundredths of cm, which
1132 means that, by default, pictures in these formats are 6 cm in
1133 width and 5 cm in height.
1135 Since this is a global graphics option, its position in the scene description
1136 does not matter. It can be also used as an argument of function @code{draw}.
1140 Option @code{dimensions} applied to file output
1145 dimensions = [300,300],
1147 explicit(x^4,x,-1,1)) $
1149 dimensions = [300,300],
1151 explicit(x^4,x,-1,1)) $
1154 Option @code{dimensions} applied to eps output.
1155 We want an eps file with A4 portrait dimensions.
1158 (%i1) A4portrait: 100*[21, 29.7]$
1160 dimensions = A4portrait,
1162 explicit(x^2-y^2,x,-2,2,y,-2,2)) $
1165 @opencatbox{Categories:}
1166 @category{Package draw}
1173 @anchor{draw_realpart}
1174 @defvr {Graphic option} draw_realpart
1175 Default value: @code{true}
1177 When @code{true}, functions to be drawn are considered as complex functions whose
1178 real part value should be plotted; when @code{false}, nothing will be plotted when
1179 the function does not give a real value.
1181 This option affects objects @mref{explicit} and @mref{parametric} in 2D and 3D, and
1182 @mrefdot{parametric_surface}
1187 draw_realpart = false,
1188 explicit(sqrt(x^2 - 4*x) - x, x, -1, 5),
1190 draw_realpart = true,
1191 parametric(x,sqrt(x^2 - 4*x) - x + 1, x, -1, 5) );
1194 @opencatbox{Categories:}
1195 @category{Package draw}
1203 @defvr {Graphic option} enhanced3d
1204 Default value: @code{none}
1206 If @code{enhanced3d} is @code{none}, surfaces are not colored in 3D plots.
1207 In order to get a colored surface, a list must be assigned to option
1208 @mrefcomma{enhanced3d} where the first element is an expression and the rest
1209 are the names of the variables or parameters used in that expression. A list such
1210 @code{[f(x,y,z), x, y, z]} means that point @code{[x,y,z]} of the surface
1211 is assigned number @code{f(x,y,z)}, which will be colored according to
1212 the actual @code{palette}. For those 3D graphic objects defined in terms of
1213 parameters, it is possible to define the color number in terms of
1214 the parameters, as in @code{[f(u), u]}, as in objects @mref{parametric} and
1215 @mrefcomma{tube} or @code{[f(u,v), u, v]}, as in object @code{parametric_surface}.
1216 While all 3D objects admit the model based on absolute coordinates,
1217 @code{[f(x,y,z), x, y, z]}, only two of them, namely @code{explicit}
1218 and @mrefcomma{elevation_grid} accept also models defined on the @code{[x,y]} coordinates,
1219 @code{[f(x,y), x, y]}. 3D graphic object @code{implicit} accepts only the
1220 @code{[f(x,y,z), x, y, z]} model. Object @code{points} accepts also the
1221 @code{[f(x,y,z), x, y, z]} model, but when points have a chronological nature,
1222 model @code{[f(k), k]} is also valid, being @code{k} an ordering parameter.
1224 When @code{enhanced3d} is assigned something different to @code{none}, options
1225 @code{color} and @code{surface_hide} are ignored.
1227 The names of the variables defined in the lists may be different to those
1228 used in the definitions of the graphic objects.
1230 In order to maintain back compatibility, @code{enhanced3d = false} is equivalent
1231 to @code{enhanced3d = none}, and @code{enhanced3d = true} is equivalent to
1232 @code{enhanced3d = [z, x, y, z]}. If an expression is given to @mrefcomma{enhanced3d}
1233 its variables must be the same used in the surface definition. This is not
1234 necessary when using lists.
1236 See option @code{palette} to learn how palettes are specified.
1240 @code{explicit} object with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1244 enhanced3d = [x-z/10,x,y,z],
1246 explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
1248 @figure{draw_enhanced3d}
1250 @code{explicit} object with coloring defined by the @code{[f(x,y), x, y]} model.
1251 The names of the variables defined in the lists may be different to those
1252 used in the definitions of the graphic objects; in this case, @code{r} corresponds
1253 to @code{x}, and @code{s} to @code{y}.
1257 enhanced3d = [sin(r*s),r,s],
1258 explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
1260 @figure{draw_enhanced3d2}
1262 @code{parametric} object with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1268 enhanced3d = [if y>= 0 then 1 else 0, x, y, z],
1269 parametric(sin(u)^2,cos(u),u,u,0,4*%pi)) $
1271 @figure{draw_enhanced3d3}
1273 @code{parametric} object with coloring defined by the @code{[f(u), u]} model.
1274 In this case, @code{(u-1)^2} is a shortcut for @code{[(u-1)^2,u]}.
1280 enhanced3d = (u-1)^2,
1281 parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2))$
1283 @figure{draw_enhanced3d4}
1285 @code{elevation_grid} object with coloring defined by the @code{[f(x,y), x, y]} model.
1290 makelist(makelist(cos(i^2/80-k/30),k,1,30),i,1,20)) $
1292 enhanced3d = [cos(x*y*10),x,y],
1293 elevation_grid(m,-1,-1,2,2),
1297 @figure{draw_enhanced3d5}
1299 @code{tube} object with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1303 enhanced3d = [cos(x-y),x,y,z],
1306 tube(cos(a), a, 0, 1, a, 0, 4*%pi) )$
1308 @figure{draw_enhanced3d6}
1310 @code{tube} object with coloring defined by the @code{[f(u), u]} model.
1311 Here, @code{enhanced3d = -a} would be the shortcut for @code{enhanced3d = [-foo,foo]}.
1315 capping = [true, false],
1316 palette = [26,15,-2],
1317 enhanced3d = [-foo, foo],
1318 tube(a, a, a^2, 1, a, -2, 2) )$
1320 @figure{draw_enhanced3d7}
1322 @code{implicit} and @code{points} objects with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1326 enhanced3d = [x-y,x,y,z],
1327 implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015,
1328 x,-1,1,y,-1.2,2.3,z,-1,1)) $
1329 (%i2) m: makelist([random(1.0),random(1.0),random(1.0)],k,1,2000)$
1331 @figure{draw_enhanced3d9}
1334 point_type = filled_circle,
1336 enhanced3d = [u+v-w,u,v,w],
1339 @figure{draw_enhanced3d10}
1341 When points have a chronological nature, model @code{[f(k), k]} is also valid,
1342 being @code{k} an ordering parameter.
1345 (%i1) m:makelist([random(1.0), random(1.0), random(1.0)],k,1,5)$
1347 enhanced3d = [sin(j), j],
1349 point_type = filled_circle,
1350 points_joined = true,
1353 @figure{draw_enhanced3d11}
1355 @opencatbox{Categories:}
1356 @category{Package draw}
1365 @defvr {Graphic option} error_type
1366 Default value: @code{y}
1368 Depending on its value, which can be @code{x}, @code{y}, or @code{xy},
1369 graphic object @code{errors} will draw points with horizontal, vertical,
1370 or both, error bars. When @code{error_type=boxes}, boxes will be drawn
1373 See also @mrefdot{errors}
1379 @defvr {Graphic option} file_name
1380 Default value: @code{"maxima_out"}
1382 This is the name of the file where terminals @code{png}, @code{jpg}, @code{gif},
1383 @code{eps}, @code{eps_color}, @code{pdf}, @code{pdfcairo} and @code{svg}
1384 will save the graphic.
1386 Since this is a global graphics option, its position in the scene description
1387 does not matter. It can be also used as an argument of function @code{draw}.
1392 (%i1) draw2d(file_name = "myfile",
1393 explicit(x^2,x,-1,1),
1397 See also @mrefcomma{terminal} @mrefdot{dimensions_draw}
1399 @opencatbox{Categories:}
1400 @category{Package draw}
1408 @defvr {Graphic option} fill_color
1409 Default value: @code{"red"}
1411 @code{fill_color} specifies the color for filling polygons and
1412 2d @code{explicit} functions.
1414 See @code{color} to learn how colors are specified.
1416 @opencatbox{Categories:}
1417 @category{Package draw}
1425 @anchor{fill_density}
1426 @defvr {Graphic option} fill_density
1429 @code{fill_density} is a number between 0 and 1 that specifies
1430 the intensity of the @code{fill_color} in @code{bars} objects.
1432 See @code{bars} for examples.
1438 @anchor{filled_func}
1439 @defvr {Graphic option} filled_func
1440 Default value: @code{false}
1442 Option @code{filled_func} controls how regions limited by functions
1443 should be filled. When @code{filled_func} is @code{true}, the region
1444 bounded by the function defined with object @code{explicit} and the
1445 bottom of the graphic window is filled with @code{fill_color}. When
1446 @code{filled_func} contains a function expression, then the region bounded
1447 by this function and the function defined with object @code{explicit}
1448 will be filled. By default, explicit functions are not filled.
1450 A useful special case is @code{filled_func=0}, which generates the region
1451 bond by the horizontal axis and the explicit function.
1453 This option affects only the 2d graphic object @mrefdot{explicit}
1457 Region bounded by an @code{explicit} object and the bottom of the
1460 (%i1) draw2d(fill_color = red,
1462 explicit(sin(x),x,0,10) )$
1464 @figure{draw_filledfunc}
1466 Region bounded by an @code{explicit} object and the function
1467 defined by option @code{filled_func}. Note that the variable in
1468 @code{filled_func} must be the same as that used in @code{explicit}.
1470 (%i1) draw2d(fill_color = grey,
1471 filled_func = sin(x),
1472 explicit(-sin(x),x,0,%pi));
1474 @figure{draw_filledfunc2}
1475 See also @mref{fill_color} and @mrefdot{explicit}
1477 @opencatbox{Categories:}
1478 @category{Package draw}
1486 @defvr {Graphic option} font
1487 Default value: @code{""} (empty string)
1489 This option can be used to set the font face to be used by the terminal.
1490 Only one font face and size can be used throughout the plot.
1492 Since this is a global graphics option, its position in the scene description
1495 See also @mrefdot{font_size}
1497 Gnuplot doesn't handle fonts by itself, it leaves this task to the
1498 support libraries of the different terminals, each one with its own
1499 philosophy about it. A brief summary follows:
1504 Uses the normal x11 font server mechanism.
1508 (%i1) draw2d(font = "Arial",
1510 label(["Arial font, size 20",1,1]))$
1515 The windows terminal doesn't support changing of fonts from inside the plot.
1516 Once the plot has been generated, the font can be changed right-clicking on
1517 the menu of the graph window.
1521 The @i{libgd} library uses the font path stored in the environment
1522 variable @env{GDFONTPATH}; in this case, it is only necessary to
1523 set option @code{font} to the font's name. It is also possible to
1524 give the complete path to the font file.
1528 Option @code{font} can be given the complete path to the font file:
1530 (%i1) path: "/usr/share/fonts/truetype/freefont/" $
1531 (%i2) file: "FreeSerifBoldItalic.ttf" $
1533 font = concat(path, file),
1536 label(["FreeSerifBoldItalic font, size 20",1,1]),
1540 If environment variable @env{GDFONTPATH} is set to the
1541 path where font files are allocated, it is possible to
1542 set graphic option @code{font} to the name of the font.
1545 font = "FreeSerifBoldItalic",
1548 label(["FreeSerifBoldItalic font, size 20",1,1]),
1554 Standard Postscript fonts are:@*
1555 @code{"Times-Roman"}, @code{"Times-Italic"}, @code{"Times-Bold"},
1556 @code{"Times-BoldItalic"},@*
1557 @code{"Helvetica"}, @code{"Helvetica-Oblique"}, @code{"Helvetica-Bold"},@*
1558 @code{"Helvetic-BoldOblique"}, @code{"Courier"},
1559 @code{"Courier-Oblique"}, @code{"Courier-Bold"},@*
1560 and @code{"Courier-BoldOblique"}.
1565 font = "Courier-Oblique",
1567 label(["Courier-Oblique font, size 15",1,1]),
1573 Uses same fonts as @i{Postscript}.
1577 Uses same fonts as @i{wxt}.
1581 The @i{pango} library finds fonts via the @code{fontconfig} utility.
1585 Default is @code{"Times-Roman"}.
1588 The gnuplot documentation is an important source of information about terminals and fonts.
1590 @opencatbox{Categories:}
1591 @category{Package draw}
1599 @defvr {Graphic option} font_size
1602 This option can be used to set the font size to be used by the terminal.
1603 Only one font face and size can be used throughout the plot. @code{font_size} is
1604 active only when option @code{font} is not equal to the empty string.
1606 Since this is a global graphics option, its position in the scene description
1609 See also @mrefdot{font}
1611 @opencatbox{Categories:}
1612 @category{Package draw}
1619 @anchor{gnuplot_file_name}
1620 @defvr {Graphic option} gnuplot_file_name
1621 Default value: @code{"maxout_xxx.gnuplot"} with @code{"xxx"}
1622 being a number that is unique to each concurrently-running
1625 This is the name of the file with the necessary commands to
1626 be processed by Gnuplot.
1628 Since this is a global graphics option, its position in the scene description
1629 does not matter. It can be also used as an argument of function @code{draw}.
1635 file_name = "my_file",
1636 gnuplot_file_name = "my_commands_for_gnuplot",
1637 data_file_name = "my_data_for_gnuplot",
1639 explicit(x^2,x,-1,1)) $
1642 See also @mrefdot{data_file_name}
1644 @opencatbox{Categories:}
1645 @category{Package draw}
1653 @defvr {Graphic option} grid
1654 Default value: @code{false}
1656 If @code{grid} is @code{not false}, a grid will be drawn on the @var{xy} plane.
1657 If @code{grid} is assigned true, one grid line per tick of each axis is drawn.
1658 If @code{grid} is assigned a list @code{nx,ny} with @code{[nx,ny] > [0,0]}
1659 instead @code{nx} lines per tick of the x axis and @code{ny} lines per tick of
1660 the y axis are drawn.
1662 Since this is a global graphics option, its position in the scene description
1668 (%i1) draw2d(grid = true,
1669 explicit(exp(u),u,-2,2))$
1674 (%i1) draw2d(grid = [2,2],
1675 explicit(sin(x),x,0,2*%pi))$
1679 @opencatbox{Categories:}
1680 @category{Package draw}
1688 @defvr {Graphic option} head_angle
1691 @code{head_angle} indicates the angle, in degrees, between the arrow heads and
1694 This option is relevant only for @code{vector} objects.
1699 (%i1) draw2d(xrange = [0,10],
1703 vector([1,1],[0,6]),
1705 vector([2,1],[0,6]),
1707 vector([3,1],[0,6]),
1709 vector([4,1],[0,6]),
1711 vector([5,1],[0,6]),
1713 vector([6,1],[0,6]),
1715 vector([7,1],[0,6]),
1717 vector([8,1],[0,6]),
1719 vector([9,1],[0,6]) )$
1721 @figure{draw_head_angle}
1723 See also @mrefcomma{head_both} @mrefcomma{head_length} and @mrefdot{head_type}
1725 @opencatbox{Categories:}
1726 @category{Package draw}
1734 @defvr {Graphic option} head_both
1735 Default value: @code{false}
1737 If @code{head_both} is @code{true}, vectors are plotted with two arrow heads.
1738 If @code{false}, only one arrow is plotted.
1740 This option is relevant only for @code{vector} objects.
1745 (%i1) draw2d(xrange = [0,8],
1748 vector([1,1],[6,0]),
1750 vector([1,7],[6,0]) )$
1752 @figure{draw_head_both}
1754 See also @mrefcomma{head_length} @mrefcomma{head_angle} and @mrefdot{head_type}
1756 @opencatbox{Categories:}
1757 @category{Package draw}
1764 @anchor{head_length}
1765 @defvr {Graphic option} head_length
1768 @code{head_length} indicates, in @var{x}-axis units, the length of arrow heads.
1770 This option is relevant only for @code{vector} objects.
1775 (%i1) draw2d(xrange = [0,12],
1777 vector([0,1],[5,5]),
1779 vector([2,1],[5,5]),
1781 vector([4,1],[5,5]),
1783 vector([6,1],[5,5]))$
1785 @figure{draw_head_length}
1787 See also @mrefcomma{head_both} @mrefcomma{head_angle} and @mrefdot{head_type}
1789 @opencatbox{Categories:}
1790 @category{Package draw}
1800 @defvr {Graphic option} head_type
1801 Default value: @code{filled}
1803 @code{head_type} is used to specify how arrow heads are plotted. Possible
1804 values are: @code{filled} (closed and filled arrow heads), @code{empty}
1805 (closed but not filled arrow heads), and @code{nofilled} (open arrow heads).
1807 This option is relevant only for @code{vector} objects.
1812 (%i1) draw2d(xrange = [0,12],
1815 vector([0,1],[5,5]), /* default type */
1817 vector([3,1],[5,5]),
1818 head_type = 'nofilled,
1819 vector([6,1],[5,5]))$
1821 @figure{draw_head_type}
1823 See also @mrefcomma{head_both} @mrefcomma{head_angle} and @mrefdot{head_length}
1825 @opencatbox{Categories:}
1826 @category{Package draw}
1833 @anchor{interpolate_color}
1834 @defvr {Graphic option} interpolate_color
1835 Default value: @code{false}
1837 This option is relevant only when @code{enhanced3d} is not @code{false}.
1839 When @code{interpolate_color} is @code{false}, surfaces are colored with
1840 homogeneous quadrangles. When @code{true}, color transitions are smoothed
1843 @code{interpolate_color} also accepts a list of two numbers, @code{[m,n]}.
1844 For positive @var{m} and @var{n}, each quadrangle or triangle is interpolated
1845 @var{m} times and @var{n} times in the respective direction. For negative
1846 @var{m} and @var{n}, the interpolation frequency is chosen so that there will be at least
1847 @var{|m|} and @var{|n|} points drawn; you can consider this as a special gridding function.
1848 Zeros, i.e. @code{interpolate_color=[0,0]}, will automatically choose an
1849 optimal number of interpolated surface points.
1851 Also, @code{interpolate_color=true} is equivalent to @code{interpolate_color=[0,0]}.
1855 Color interpolation with explicit functions.
1859 enhanced3d = sin(x*y),
1860 explicit(20*exp(-x^2-y^2)-10, x ,-3, 3, y, -3, 3)) $
1862 @figure{draw_interpolate_color}
1865 interpolate_color = true,
1866 enhanced3d = sin(x*y),
1867 explicit(20*exp(-x^2-y^2)-10, x ,-3, 3, y, -3, 3)) $
1869 @figure{draw_interpolate_color2}
1872 interpolate_color = [-10,0],
1873 enhanced3d = sin(x*y),
1874 explicit(20*exp(-x^2-y^2)-10, x ,-3, 3, y, -3, 3)) $
1876 @figure{draw_interpolate_color3}
1878 Color interpolation with the @code{mesh} graphic object.
1880 Interpolating colors in parametric surfaces can give unexpected results.
1885 mesh([[1,1,3], [7,3,1],[12,-2,4],[15,0,5]],
1886 [[2,7,8], [4,3,1],[10,5,8], [12,7,1]],
1887 [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
1889 @figure{draw_interpolate_color4}
1893 interpolate_color = true,
1894 mesh([[1,1,3], [7,3,1],[12,-2,4],[15,0,5]],
1895 [[2,7,8], [4,3,1],[10,5,8], [12,7,1]],
1896 [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
1898 @figure{draw_interpolate_color5}
1902 interpolate_color = true,
1904 mesh([[1,1,3], [7,3,1],[12,-2,4],[15,0,5]],
1905 [[2,7,8], [4,3,1],[10,5,8], [12,7,1]],
1906 [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
1908 @figure{draw_interpolate_color6}
1910 See also @mrefdot{enhanced3d}
1912 @opencatbox{Categories:}
1913 @category{Package draw}
1921 @defvr {Graphic option} ip_grid
1922 Default value: @code{[50, 50]}
1924 @code{ip_grid} sets the grid for the first sampling in implicit plots.
1926 This option is relevant only for @code{implicit} objects.
1928 @opencatbox{Categories:}
1929 @category{Package draw}
1937 @defvr {Graphic option} ip_grid_in
1938 Default value: @code{[5, 5]}
1940 @code{ip_grid_in} sets the grid for the second sampling in implicit plots.
1942 This option is relevant only for @code{implicit} objects.
1944 @opencatbox{Categories:}
1945 @category{Package draw}
1953 @defvr {Graphic option} key
1954 Default value: @code{""} (empty string)
1956 @code{key} is the name of a function in the legend. If @code{key} is an
1957 empty string, no key is assigned to the function.
1959 This option affects the following graphic objects:
1962 @code{gr2d}: @mrefcomma{points} @mrefcomma{polygon} @mrefcomma{rectangle}
1963 @mrefcomma{ellipse} @mrefcomma{vector} @mrefcomma{explicit} @mrefcomma{implicit}
1964 @mref{parametric} and @mrefdot{polar}
1967 @code{gr3d}: @mrefcomma{points} @mrefcomma{explicit} @mref{parametric}
1968 and @mrefdot{parametric_surface}
1974 (%i1) draw2d(key = "Sinus",
1975 explicit(sin(x),x,0,10),
1978 explicit(cos(x),x,0,10) )$
1981 @opencatbox{Categories:}
1982 @category{Package draw}
1991 @defvr {Graphic option} key_pos
1992 Default value: @code{""} (empty string)
1994 @code{key_pos} defines at which position the legend will be drawn. If @code{key} is an
1995 empty string, @code{"top_right"} is used.
1996 Available position specifiers are: @code{top_left}, @code{top_center}, @code{top_right},
1997 @code{center_left}, @code{center}, @code{center_right},
1998 @code{bottom_left}, @code{bottom_center}, and @code{bottom_right}.
2000 Since this is a global graphics option, its position in the scene description
2009 explicit(x, x,0,10),
2012 explicit(x^2,x,0,10))$
2016 explicit(x+y,x,0,10,y,0,10),
2019 explicit(x^2+y^2,x,0,10,y,0,10))$
2021 @figure{draw_key_pos}
2023 @opencatbox{Categories:}
2024 @category{Package draw}
2031 @anchor{label_alignment}
2032 @defvr {Graphic option} label_alignment
2033 Default value: @code{center}
2035 @code{label_alignment} is used to specify where to write labels with
2036 respect to the given coordinates. Possible values are: @code{center},
2037 @code{left}, and @code{right}.
2039 This option is relevant only for @code{label} objects.
2044 (%i1) draw2d(xrange = [0,10],
2046 points_joined = true,
2047 points([[5,0],[5,10]]),
2049 label(["Centered alignment (default)",5,2]),
2050 label_alignment = 'left,
2051 label(["Left alignment",5,5]),
2052 label_alignment = 'right,
2053 label(["Right alignment",5,8]))$
2055 @figure{draw_label_alignment}
2057 See also @mrefcomma{label_orientation} and @code{color}
2059 @opencatbox{Categories:}
2060 @category{Package draw}
2067 @anchor{label_orientation}
2068 @defvr {Graphic option} label_orientation
2069 Default value: @code{horizontal}
2071 @code{label_orientation} is used to specify orientation of labels.
2072 Possible values are: @code{horizontal}, and @code{vertical}.
2074 This option is relevant only for @code{label} objects.
2078 In this example, a dummy point is added to get an image.
2079 Package @code{draw} needs always data to draw an scene.
2081 (%i1) draw2d(xrange = [0,10],
2086 label(["Horizontal orientation (default)",5,2]),
2087 label_orientation = 'vertical,
2089 label(["Vertical orientation",1,5]))$
2091 @figure{draw_label_orientation}
2093 See also @mref{label_alignment} and @code{color}
2095 @opencatbox{Categories:}
2096 @category{Package draw}
2104 @defvr {Graphic option} line_type
2105 Default value: @code{solid}
2107 @code{line_type} indicates how lines are displayed; possible values are
2108 @code{solid} and @code{dots}, both available in all terminals, and
2109 @code{dashes}, @code{short_dashes}, @code{short_long_dashes}, @code{short_short_long_dashes},
2110 and @code{dot_dash}, which are not available in @code{png}, @code{jpg}, and @code{gif} terminals.
2112 This option affects the following graphic objects:
2115 @code{gr2d}: @mrefcomma{points} @mrefcomma{polygon} @mrefcomma{rectangle}
2116 @mrefcomma{ellipse} @mrefcomma{vector} @mrefcomma{explicit} @mrefcomma{implicit}
2117 @mref{parametric} and @mrefdot{polar}
2120 @code{gr3d}: @mrefcomma{points} @mrefcomma{explicit} @mref{parametric} and @mrefdot{parametric_surface}
2126 (%i1) draw2d(line_type = dots,
2127 explicit(1 + x^2,x,-1,1),
2128 line_type = solid, /* default */
2129 explicit(2 + x^2,x,-1,1))$
2131 @figure{draw_line_type}
2133 See also @mrefdot{line_width}
2135 @opencatbox{Categories:}
2136 @category{Package draw}
2144 @defvr {Graphic option} line_width
2147 @code{line_width} is the width of plotted lines.
2148 Its value must be a positive number.
2150 This option affects the following graphic objects:
2153 @code{gr2d}: @mrefcomma{points} @mrefcomma{polygon} @mrefcomma{rectangle}
2154 @mrefcomma{ellipse} @mrefcomma{vector} @mrefcomma{explicit} @mrefcomma{implicit}
2155 @mref{parametric} and @mrefdot{polar}
2158 @code{gr3d}: @mref{points} and @mrefdot{parametric}
2164 (%i1) draw2d(explicit(x^2,x,-1,1), /* default width */
2166 explicit(1 + x^2,x,-1,1),
2168 explicit(2 + x^2,x,-1,1))$
2170 @figure{draw_line_width}
2172 See also @mrefdot{line_type}
2174 @opencatbox{Categories:}
2175 @category{Package draw}
2183 @defvr {Graphic option} logcb
2184 Default value: @code{false}
2186 If @mref{logcb} is @code{true}, the tics in the colorbox will be drawn in the
2189 When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{logcb} has
2192 Since this is a global graphics option, its position in the scene description
2203 palette = [-15,24,-9],
2204 explicit(exp(x^2-y^2), x,-2,2,y,-2,2)) $
2208 See also @mrefcomma{enhanced3d} @mref{colorbox} and @mrefdot{cbrange}
2210 @opencatbox{Categories:}
2211 @category{Package draw}
2219 @defvr {Graphic option} logx
2220 Default value: @code{false}
2222 If @code{logx} is @code{true}, the @var{x} axis will be drawn in the
2225 Since this is a global graphics option, its position in the scene description
2226 does not matter, with the exception that it should be written before any
2227 2D @code{explicit} object, so that @code{draw} can produce a better plot.
2232 (%i1) draw2d(logx = true,
2233 explicit(log(x),x,0.01,5))$
2236 See also @mrefcomma{logy} @mrefcomma{logx_secondary} @mrefcomma{logy_secondary} and @mrefdot{logz}
2238 @opencatbox{Categories:}
2239 @category{Package draw}
2246 @anchor{logx_secondary}
2247 @defvr {Graphic option} logx_secondary
2248 Default value: @code{false}
2250 If @code{logx_secondary} is @code{true}, the secondary @var{x} axis
2251 will be drawn in the logarithmic scale.
2253 This option is relevant only for 2d scenes.
2255 Since this is a global graphics option, its position in the scene description
2263 key="x^2, linear scale",
2265 explicit(x^2,x,1,100),
2266 xaxis_secondary = true,
2267 xtics_secondary = true,
2268 logx_secondary = true,
2269 key = "x^2, logarithmic x scale",
2271 explicit(x^2,x,1,100) )$
2273 @figure{draw_logx_secondary}
2275 See also @mrefcomma{logx_draw} @mrefcomma{logy_draw} @mrefcomma{logy_secondary} and @mrefdot{logz}
2277 @opencatbox{Categories:}
2278 @category{Package draw}
2286 @defvr {Graphic option} logy
2287 Default value: @code{false}
2289 If @code{logy} is @code{true}, the @var{y} axis will be drawn in the
2292 Since this is a global graphics option, its position in the scene description
2298 (%i1) draw2d(logy = true,
2299 explicit(exp(x),x,0,5))$
2302 See also @mrefcomma{logx_draw} @mrefcomma{logx_secondary} @mrefcomma{logy_secondary} and @mrefdot{logz}
2304 @opencatbox{Categories:}
2305 @category{Package draw}
2312 @anchor{logy_secondary}
2313 @defvr {Graphic option} logy_secondary
2314 Default value: @code{false}
2316 If @code{logy_secondary} is @code{true}, the secondary @var{y} axis
2317 will be drawn in the logarithmic scale.
2319 This option is relevant only for 2d scenes.
2321 Since this is a global graphics option, its position in the scene description
2329 key="x^2, linear scale",
2331 explicit(x^2,x,1,100),
2332 yaxis_secondary = true,
2333 ytics_secondary = true,
2334 logy_secondary = true,
2335 key = "x^2, logarithmic y scale",
2337 explicit(x^2,x,1,100) )$
2340 See also @mrefcomma{logx_draw} @mrefcomma{logy_draw} @mrefcomma{logx_secondary} and @mrefdot{logz}
2342 @opencatbox{Categories:}
2343 @category{Package draw}
2351 @defvr {Graphic option} logz
2352 Default value: @code{false}
2354 If @code{logz} is @code{true}, the @var{z} axis will be drawn in the
2357 Since this is a global graphics option, its position in the scene description
2363 (%i1) draw3d(logz = true,
2364 explicit(exp(u^2+v^2),u,-2,2,v,-2,2))$
2367 See also @mref{logx_draw} and @mrefdot{logy_draw}
2369 @opencatbox{Categories:}
2370 @category{Package draw}
2377 @defvr {Graphic option} nticks
2380 In 2d, @code{nticks} gives the initial number of points used by the
2381 adaptive plotting routine for explicit objects. It is also the
2382 number of points that will be shown in parametric and polar curves.
2384 This option affects the following graphic objects:
2387 @code{gr2d}: @mrefcomma{ellipse} @mrefcomma{explicit} @mref{parametric} and @mrefdot{polar}
2390 @code{gr3d}: @mrefdot{parametric}
2393 See also @code{adapt_depth}
2398 (%i1) draw2d(transparent = true,
2399 ellipse(0,0,4,2,0,180),
2401 ellipse(0,0,4,2,180,180) )$
2403 @figure{draw_nticks}
2405 @opencatbox{Categories:}
2406 @category{Package draw}
2413 @anchor{palette_draw}
2414 @defvr {Graphic option} palette
2415 Default value: @code{color}
2417 @code{palette} indicates how to map gray levels onto color components.
2418 It works together with option @code{enhanced3d} in 3D graphics,
2419 who associates every point of a surfaces to a real number or gray level.
2420 It also works with gray images. With @code{palette}, levels are transformed into colors.
2422 There are two ways for defining these transformations.
2424 First, @code{palette} can be a vector of length three with components
2425 ranging from -36 to +36; each value is an index for a formula mapping the levels
2426 onto red, green and blue colors, respectively:
2430 6: x^4 7: sqrt(x) 8: sqrt(sqrt(x))
2431 9: sin(90x) 10: cos(90x) 11: |x-0.5|
2432 12: (2x-1)^2 13: sin(180x) 14: |cos(180x)|
2433 15: sin(360x) 16: cos(360x) 17: |sin(360x)|
2434 18: |cos(360x)| 19: |sin(720x)| 20: |cos(720x)|
2435 21: 3x 22: 3x-1 23: 3x-2
2436 24: |3x-1| 25: |3x-2| 26: (3x-1)/2
2437 27: (3x-2)/2 28: |(3x-1)/2| 29: |(3x-2)/2|
2438 30: x/0.32-0.78125 31: 2*x-0.84 32: 4x;1;-2x+1.84;x/0.08-11.5
2439 33: |2*x - 0.5| 34: 2*x 35: 2*x - 0.5
2442 negative numbers mean negative colour component.
2443 @code{palette = gray} and @code{palette = color} are short cuts for
2444 @code{palette = [3,3,3]} and @code{palette = [7,5,15]}, respectively.
2446 Second, @code{palette} can be a user defined lookup table. In this case,
2447 the format for building a lookup table of length @code{n} is
2448 @code{palette=[color_1, color_2, ..., color_n]}, where @code{color_i} is
2449 a well formed color (see option @code{color}) such that @code{color_1} is
2450 assigned to the lowest gray level and @code{color_n} to the highest. The rest
2451 of colors are interpolated.
2453 Since this is a global graphics option, its position in the scene description
2458 It works together with option @code{enhanced3d} in 3D graphics.
2462 enhanced3d = [z-x+2*y,x,y,z],
2463 palette = [32, -8, 17],
2464 explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
2466 @figure{draw_palette}
2468 It also works with gray images.
2473 makelist(makelist(random(200),i,1,30),i,1,30))$
2474 (%i2) /* palette = color, default */
2475 draw2d(image(im,0,0,30,30))$
2476 (%i3) draw2d(palette = gray, image(im,0,0,30,30))$
2477 (%i4) draw2d(palette = [15,20,-4],
2479 image(im,0,0,30,30))$
2481 @figure{draw_palette2}
2483 @code{palette} can be a user defined lookup table.
2484 In this example, low values of @code{x} are colored
2485 in red, and higher values in yellow.
2489 palette = [red, blue, yellow],
2491 explicit(x^2+y^2,x,-1,1,y,-1,1)) $
2493 @figure{draw_palette3}
2495 See also @mref{colorbox} and @mrefdot{enhanced3d}
2497 @opencatbox{Categories:}
2498 @category{Package draw}
2506 @defvr {Graphic option} point_size
2509 @code{point_size} sets the size for plotted points. It must be a
2510 non negative number.
2512 This option has no effect when graphic option @code{point_type} is
2515 This option affects the following graphic objects:
2518 @code{gr2d}: @mrefdot{points}
2521 @code{gr3d}: @mrefdot{points}
2527 (%i1) draw2d(points(makelist([random(20),random(50)],k,1,10)),
2529 points(makelist(k,k,1,20),makelist(random(30),k,1,20)))$
2531 @figure{draw_point_size}
2533 @opencatbox{Categories:}
2534 @category{Package draw}
2541 @anchor{point_type_draw}
2542 @defvr {Graphic option} point_type
2545 @code{point_type} indicates how isolated points are displayed; the value of this
2546 option can be any integer index greater or equal than -1, or the name of
2547 a point style: @code{$none} (-1), @code{dot} (0), @code{plus} (1), @code{multiply} (2),
2548 @code{asterisk} (3), @code{square} (4), @code{filled_square} (5), @code{circle} (6),
2549 @code{filled_circle} (7), @code{up_triangle} (8), @code{filled_up_triangle} (9),
2550 @code{down_triangle} (10), @code{filled_down_triangle} (11), @code{diamant} (12) and
2551 @code{filled_diamant} (13).
2553 This option affects the following graphic objects:
2556 @code{gr2d}: @mrefdot{points}
2559 @code{gr3d}: @mrefdot{points}
2565 (%i1) draw2d(xrange = [0,10],
2568 point_type = diamant,
2569 points([[1,1],[5,1],[9,1]]),
2570 point_type = filled_down_triangle,
2571 points([[1,2],[5,2],[9,2]]),
2572 point_type = asterisk,
2573 points([[1,3],[5,3],[9,3]]),
2574 point_type = filled_diamant,
2575 points([[1,4],[5,4],[9,4]]),
2577 points([[1,5],[5,5],[9,5]]),
2579 points([[1,6],[5,6],[9,6]]),
2580 point_type = filled_circle,
2581 points([[1,7],[5,7],[9,7]]),
2583 points([[1,8],[5,8],[9,8]]),
2584 point_type = filled_diamant,
2585 points([[1,9],[5,9],[9,9]]) )$
2587 @figure{draw_point_type}
2589 @opencatbox{Categories:}
2590 @category{Package draw}
2597 @anchor{points_joined}
2598 @defvr {Graphic option} points_joined
2599 Default value: @code{false}
2601 When @code{points_joined} is @code{true}, points are joined by lines; when @code{false},
2602 isolated points are drawn. A third possible value for this graphic option is
2603 @code{impulses}; in such case, vertical segments are drawn from points to the x-axis (2D)
2604 or to the xy-plane (3D).
2606 This option affects the following graphic objects:
2609 @code{gr2d}: @mrefdot{points}
2612 @code{gr3d}: @mrefdot{points}
2618 (%i1) draw2d(xrange = [0,10],
2621 point_type = up_triangle,
2623 points([[1,1],[5,1],[9,1]]),
2624 points_joined = true,
2625 point_type = square,
2627 points([[1,2],[5,2],[9,2]]),
2628 point_type = circle,
2631 points([[1,3],[5,3],[9,3]]) )$
2633 @figure{draw_points_joined}
2635 @opencatbox{Categories:}
2636 @category{Package draw}
2643 @anchor{proportional_axes}
2644 @defvr {Graphic option} proportional_axes
2645 Default value: @code{none}
2647 When @code{proportional_axes} is equal to @code{xy} or @code{xyz},
2648 the aspect ratio of the axis units will be set to 1:1 resulting in a 2D or 3D
2649 scene that will be drawn with axes proportional to their relative lengths.
2651 Since this is a global graphics option, its position in the scene description
2654 This option works with Gnuplot version 4.2.6 or greater.
2662 ellipse(0,0,1,1,0,360),
2666 ellipse(0,0,2,1/2,0,360),
2667 proportional_axes = 'xy) $
2669 @figure{draw_proportional_axis}
2676 gr2d(proportional_axes = 'xy,
2677 explicit(x^2,x,0,1)),
2678 gr2d(explicit(x^2,x,0,1),
2681 proportional_axes='xy),
2682 gr2d(explicit(x^2,x,0,1)))$
2684 @figure{draw_proportional_axis2}
2686 @opencatbox{Categories:}
2687 @category{Package draw}
2694 @anchor{surface_hide}
2695 @defvr {Graphic option} surface_hide
2696 Default value: @code{false}
2698 If @code{surface_hide} is @code{true}, hidden parts are not plotted in 3d surfaces.
2700 Since this is a global graphics option, its position in the scene description
2706 (%i1) draw(columns=2,
2707 gr3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)),
2708 gr3d(surface_hide = true,
2709 explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)) )$
2711 @figure{draw_surface_hide}
2713 @opencatbox{Categories:}
2714 @category{Package draw}
2722 @defvr {Graphic option} terminal
2723 Default value: @code{screen}
2725 Selects the terminal to be used by Gnuplot; possible values are:
2726 @code{screen} (default), @code{png}, @code{pngcairo}, @code{jpg}, @code{gif},
2727 @code{eps}, @code{eps_color}, @code{epslatex}, @code{epslatex_standalone},
2728 @code{svg}, @code{canvas}, @code{dumb}, @code{dumb_file}, @code{pdf}, @code{pdfcairo},
2729 @code{wxt}, @code{animated_gif}, @code{multipage_pdfcairo}, @code{multipage_pdf},
2730 @code{multipage_eps}, @code{multipage_eps_color}, and @code{aquaterm}.
2732 Terminals @code{screen}, @code{wxt}, @code{windows} and @code{aquaterm} can
2733 be also defined as a list
2734 with two elements: the name of the terminal itself and a non negative integer number.
2735 In this form, multiple windows can be opened at the same time, each with its
2736 corresponding number. This feature does not work in Windows platforms.
2738 Since this is a global graphics option, its position in the scene description
2739 does not matter. It can be also used as an argument of function @code{draw}.
2741 N.B. pdfcairo requires Gnuplot 4.3 or newer.
2742 @code{pdf} requires Gnuplot to be compiled with the option @code{--enable-pdf} and libpdf must
2743 be installed. The pdf library is available from: @url{http://www.pdflib.com/en/download/pdflib-family/pdflib-lite/}
2748 (%i1) /* screen terminal (default) */
2749 draw2d(explicit(x^2,x,-1,1))$
2750 (%i2) /* png file */
2751 draw2d(terminal = 'png,
2752 explicit(x^2,x,-1,1))$
2753 (%i3) /* jpg file */
2754 draw2d(terminal = 'jpg,
2755 dimensions = [300,300],
2756 explicit(x^2,x,-1,1))$
2757 (%i4) /* eps file */
2758 draw2d(file_name = "myfile",
2759 explicit(x^2,x,-1,1),
2761 (%i5) /* pdf file */
2762 draw2d(file_name = "mypdf",
2763 dimensions = 100*[12.0,8.0],
2764 explicit(x^2,x,-1,1),
2766 (%i6) /* wxwidgets window */
2767 draw2d(explicit(x^2,x,-1,1),
2773 (%i1) draw2d(explicit(x^5,x,-2,2), terminal=[screen, 3])$
2774 (%i2) draw2d(explicit(x^2,x,-2,2), terminal=[screen, 0])$
2777 An animated gif file.
2782 terminal = 'animated_gif,
2783 gr2d(explicit(x^2,x,-1,1)),
2784 gr2d(explicit(x^3,x,-1,1)),
2785 gr2d(explicit(x^4,x,-1,1)));
2786 End of animation sequence
2787 (%o1) [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
2790 Option @code{delay} is only active in animated gif's; it is ignored in
2793 Multipage output in eps format.
2796 file_name = "parabol",
2797 terminal = multipage_eps,
2798 dimensions = 100*[10,10],
2799 gr2d(explicit(x^2,x,-1,1)),
2800 gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1))) $
2803 See also @mrefcomma{file_name} @mref{dimensions_draw} and @mrefdot{delay}
2805 @opencatbox{Categories:}
2806 @category{Package draw}
2814 @defvr {Graphic option} title
2815 Default value: @code{""} (empty string)
2817 Option @code{title}, a string, is the main title for the scene.
2818 By default, no title is written.
2820 Since this is a global graphics option, its position in the scene description
2826 (%i1) draw2d(explicit(exp(u),u,-2,2),
2827 title = "Exponential function")$
2831 @opencatbox{Categories:}
2832 @category{Package draw}
2840 @defvr {Graphic option} transform
2841 Default value: @code{none}
2843 If @code{transform} is @code{none}, the space is not transformed and
2844 graphic objects are drawn as defined. When a space transformation is
2845 desired, a list must be assigned to option @code{transform}. In case of
2846 a 2D scene, the list takes the form @code{[f1(x,y), f2(x,y), x, y]}.
2847 In case of a 3D scene, the list is of the form
2848 @code{[f1(x,y,z), f2(x,y,z), f3(x,y,z), x, y, z]}.
2850 The names of the variables defined in the lists may be different to those
2851 used in the definitions of the graphic objects.
2861 proportional_axes = 'xy,
2863 triangle([3,2],[7,2],[5,5]),
2865 fill_color = yellow,
2866 transform = [cos(th)*x - sin(th)*y,
2867 sin(th)*x + cos(th)*y, x, y],
2868 triangle([3,2],[7,2],[5,5]) )$
2870 @figure{draw_transform}
2877 explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3),
2878 transform = [x+10,y+10,z+10,x,y,z],
2880 explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3) )$
2883 @opencatbox{Categories:}
2884 @category{Package draw}
2890 @anchor{transparent}
2891 @defvr {Graphic option} transparent
2892 Default value: @code{false}
2894 If @code{transparent} is @code{false}, interior regions of polygons are
2895 filled according to @code{fill_color}.
2897 This option affects the following graphic objects:
2900 @code{gr2d}: @mrefcomma{polygon} @mref{rectangle} and @mrefdot{ellipse}
2906 (%i1) draw2d(polygon([[3,2],[7,2],[5,5]]),
2909 polygon([[5,2],[9,2],[7,5]]) )$
2911 @figure{draw_transparent}
2913 @opencatbox{Categories:}
2914 @category{Package draw}
2921 @anchor{unit_vectors}
2922 @defvr {Graphic option} unit_vectors
2923 Default value: @code{false}
2925 If @code{unit_vectors} is @code{true}, vectors are plotted with module 1.
2926 This is useful for plotting vector fields. If @code{unit_vectors} is @code{false},
2927 vectors are plotted with its original length.
2929 This option is relevant only for @code{vector} objects.
2934 (%i1) draw2d(xrange = [-1,6],
2937 vector([0,0],[5,2]),
2938 unit_vectors = true,
2940 vector([0,3],[5,2]))$
2942 @figure{draw_unit_vectors}
2944 @opencatbox{Categories:}
2945 @category{Package draw}
2952 @anchor{user_preamble}
2953 @defvr {Graphic option} user_preamble
2954 Default value: @code{""} (empty string)
2956 Expert Gnuplot users can make use of this option to fine tune Gnuplot's
2957 behaviour by writing settings to be sent before the @code{plot} or @code{splot}
2960 The value of this option must be a string or a list of strings (one per line).
2962 Since this is a global graphics option, its position in the scene description
2967 Tell Gnuplot to draw axes and grid on top of graphics objects,
2970 xaxis =true, xaxis_type=solid,
2971 yaxis =true, yaxis_type=solid,
2972 user_preamble="set grid front",
2973 region(x^2+y^2<1 ,x,-1.5,1.5,y,-1.5,1.5))$
2975 @figure{draw_user_preamble}
2977 Tell gnuplot to draw all contour lines in black
2982 surface_hide=true,enhanced3d=true,wired_surface=true,
2984 user_preamble="set for [i=1:8] linetype i dashtype i linecolor 0",
2985 explicit(sin(x)*cos(y),x,1,10,y,1,10)
2988 @figure{draw_user_preamble2}
2990 @opencatbox{Categories:}
2991 @category{Package draw}
3000 @defvr {Graphic option} view
3001 Default value: @code{[60,30]}
3003 A pair of angles, measured in degrees, indicating the view direction in a
3004 3D scene. The first angle is the vertical rotation around the @var{x} axis, in
3005 the range @math{[0, 360]}. The second one is the horizontal rotation around
3006 the @var{z} axis, in the range @math{[0, 360]}.
3008 If option @code{view} is given the value @code{map}, the view direction is set
3009 to be perpendicular to the xy-plane.
3011 Since this is a global graphics option, its position in the scene description
3017 (%i1) draw3d(view = [170, 50],
3019 explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
3023 (%i2) draw3d(view = map,
3025 explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
3029 @opencatbox{Categories:}
3030 @category{Package draw}
3038 @anchor{wired_surface}
3039 @defvr {Graphic option} wired_surface
3040 Default value: @code{false}
3042 Indicates whether 3D surfaces in @code{enhanced3d} mode show the grid joining
3045 Since this is a global graphics option, its position in the scene description
3052 enhanced3d = [sin(x),x,y],
3053 wired_surface = true,
3054 explicit(x^2+y^2,x,-1,1,y,-1,1)) $
3056 @figure{draw_wired_surface}
3058 @opencatbox{Categories:}
3059 @category{Package draw}
3068 @defvr {Graphic option} x_voxel
3071 @code{x_voxel} is the number of voxels in the x direction to
3072 be used by the @i{marching cubes algorithm} implemented
3073 by the 3d @code{implicit} object. It is also used by graphic
3074 object @mrefdot{region}
3076 @opencatbox{Categories:}
3077 @category{Package draw}
3086 @defvr {Graphic option} xaxis
3087 Default value: @code{false}
3089 If @code{xaxis} is @code{true}, the @var{x} axis is drawn.
3091 Since this is a global graphics option, its position in the scene description
3097 (%i1) draw2d(explicit(x^3,x,-1,1),
3099 xaxis_color = blue)$
3103 See also @mrefcomma{xaxis_width} @mref{xaxis_type} and @mrefdot{xaxis_color}
3105 @opencatbox{Categories:}
3106 @category{Package draw}
3114 @anchor{xaxis_color}
3115 @defvr {Graphic option} xaxis_color
3116 Default value: @code{"black"}
3118 @code{xaxis_color} specifies the color for the @var{x} axis. See
3119 @code{color} to know how colors are defined.
3121 Since this is a global graphics option, its position in the scene description
3127 (%i1) draw2d(explicit(x^3,x,-1,1),
3132 See also @mrefcomma{xaxis} @mref{xaxis_width} and @mrefdot{xaxis_type}
3134 @opencatbox{Categories:}
3135 @category{Package draw}
3142 @anchor{xaxis_secondary}
3143 @defvr {Graphic option} xaxis_secondary
3144 Default value: @code{false}
3146 If @code{xaxis_secondary} is @code{true}, function values can be plotted with
3147 respect to the second @var{x} axis, which will be drawn on top of the scene.
3149 Note that this is a local graphics option which only affects to 2d plots.
3155 key = "Bottom x-axis",
3156 explicit(x+1,x,1,2),
3158 key = "Above x-axis",
3159 xtics_secondary = true,
3160 xaxis_secondary = true,
3161 explicit(x^2,x,-1,1)) $
3163 @figure{draw_xaxis_secondary}
3165 See also @mrefcomma{xrange_secondary} @mrefcomma{xtics_secondary} @mrefcomma{xtics_rotate_secondary}
3166 @code{xtics_axis_secondary} and @mrefdot{xaxis_secondary}
3167 @c TODO: Document xtics_axis_secondary
3168 @opencatbox{Categories:}
3169 @category{Package draw}
3178 @defvr {Graphic option} xaxis_type
3179 Default value: @code{dots}
3181 @code{xaxis_type} indicates how the @var{x} axis is displayed;
3182 possible values are @code{solid} and @code{dots}
3184 Since this is a global graphics option, its position in the scene description
3190 (%i1) draw2d(explicit(x^3,x,-1,1),
3192 xaxis_type = solid)$
3195 See also @mrefcomma{xaxis} @mref{xaxis_width} and @mrefdot{xaxis_color}
3197 @opencatbox{Categories:}
3198 @category{Package draw}
3205 @anchor{xaxis_width}
3206 @defvr {Graphic option} xaxis_width
3209 @code{xaxis_width} is the width of the @var{x} axis.
3210 Its value must be a positive number.
3212 Since this is a global graphics option, its position in the scene description
3218 (%i1) draw2d(explicit(x^3,x,-1,1),
3223 See also @mrefcomma{xaxis} @mref{xaxis_type} and @mrefdot{xaxis_color}
3225 @opencatbox{Categories:}
3226 @category{Package draw}
3233 @anchor{xlabel_draw}
3234 @defvr {Graphic option} xlabel
3235 Default value: @code{""}
3237 Option @code{xlabel}, a string, is the label for the @var{x} axis.
3238 By default, the axis is labeled with string @code{"x"}.
3240 Since this is a global graphics option, its position in the scene description
3246 (%i1) draw2d(xlabel = "Time",
3247 explicit(exp(u),u,-2,2),
3248 ylabel = "Population")$
3251 See also @mrefcomma{xlabel_secondary} @mrefcomma{ylabel} @mref{ylabel_secondary} and @mrefdot{zlabel_draw}
3253 @opencatbox{Categories:}
3254 @category{Package draw}
3261 @anchor{xlabel_secondary}
3262 @defvr {Graphic option} xlabel_secondary
3263 Default value: @code{""} (empty string)
3265 Option @code{xlabel_secondary}, a string, is the label for the secondary @var{x} axis.
3266 By default, no label is written.
3268 Since this is a global graphics option, its position in the scene description
3275 xaxis_secondary=true,yaxis_secondary=true,
3276 xtics_secondary=true,ytics_secondary=true,
3277 xlabel_secondary="t[s]",
3278 ylabel_secondary="U[V]",
3279 explicit(sin(t),t,0,10) )$
3281 @figure{draw_ylabel_secondary}
3283 See also @mrefcomma{xlabel_draw} @mrefcomma{ylabel_draw} @mref{ylabel_secondary} and @mrefdot{zlabel_draw}
3285 @opencatbox{Categories:}
3286 @category{Package draw}
3294 @defvr {Graphic option} xrange
3295 Default value: @code{auto}
3297 If @code{xrange} is @code{auto}, the range for the @var{x} coordinate is
3298 computed automatically.
3300 If the user wants a specific interval for @var{x}, it must be given as a
3301 Maxima list, as in @code{xrange=[-2, 3]}.
3303 Since this is a global graphics option, its position in the scene description
3309 (%i1) draw2d(xrange = [-3,5],
3310 explicit(x^2,x,-1,1))$
3313 See also @mref{yrange} and @mrefdot{zrange}
3315 @opencatbox{Categories:}
3316 @category{Package draw}
3323 @anchor{xrange_secondary}
3324 @defvr {Graphic option} xrange_secondary
3325 Default value: @code{auto}
3327 If @code{xrange_secondary} is @code{auto}, the range for the second @var{x} axis is
3328 computed automatically.
3330 If the user wants a specific interval for the second @var{x} axis, it must be given as a
3331 Maxima list, as in @code{xrange_secondary=[-2, 3]}.
3333 Since this is a global graphics option, its position in the scene description
3336 See also @mrefcomma{xrange} @mrefcomma{yrange} @mref{zrange} and @mrefdot{yrange_secondary}
3338 @opencatbox{Categories:}
3339 @category{Package draw}
3347 @defvr {Graphic option} xtics
3348 Default value: @code{true}
3350 This graphic option controls the way tic marks are drawn on the @var{x} axis.
3354 When option @code{xtics} is bounded to symbol @var{true}, tic marks are
3355 drawn automatically.
3358 When option @code{xtics} is bounded to symbol @var{false}, tic marks are
3362 When option @code{xtics} is bounded to a positive number, this is the distance
3363 between two consecutive tic marks.
3366 When option @code{xtics} is bounded to a list of length three of the
3367 form @code{[start,incr,end]}, tic marks are plotted from @code{start}
3368 to @code{end} at intervals of length @code{incr}.
3371 When option @code{xtics} is bounded to a set of numbers of the
3372 form @code{@{n1, n2, ...@}}, tic marks are plotted at values @code{n1},
3376 When option @code{xtics} is bounded to a set of pairs of the
3377 form @code{@{["label1", n1], ["label2", n2], ...@}}, tic marks corresponding to values @code{n1},
3378 @code{n2}, ... are labeled with @code{"label1"}, @code{"label2"}, ..., respectively.
3381 Since this is a global graphics option, its position in the scene description
3388 (%i1) draw2d(xtics = 'false,
3389 explicit(x^3,x,-1,1) )$
3392 Tics every 1/4 units.
3394 (%i1) draw2d(xtics = 1/4,
3395 explicit(x^3,x,-1,1) )$
3398 Tics from -3/4 to 3/4 in steps of 1/8.
3400 (%i1) draw2d(xtics = [-3/4,1/8,3/4],
3401 explicit(x^3,x,-1,1) )$
3404 Tics at points -1/2, -1/4 and 3/4.
3406 (%i1) draw2d(xtics = @{-1/2,-1/4,3/4@},
3407 explicit(x^3,x,-1,1) )$
3412 (%i1) draw2d(xtics = @{["High",0.75],["Medium",0],["Low",-0.75]@},
3413 explicit(x^3,x,-1,1) )$
3416 See also @mrefcomma{ytics_draw} and @mrefdot{ztics_draw}
3418 @opencatbox{Categories:}
3419 @category{Package draw}
3427 @defvr {Graphic option} xtics_axis
3428 Default value: @code{false}
3430 If @code{xtics_axis} is @code{true}, tic marks and their labels are plotted just
3431 along the @var{x} axis, if it is @code{false} tics are plotted on the border.
3433 Since this is a global graphics option, its position in the scene description
3436 @opencatbox{Categories:}
3437 @category{Package draw}
3444 @anchor{xtics_rotate}
3445 @defvr {Graphic option} xtics_rotate
3446 Default value: @code{false}
3448 If @code{xtics_rotate} is @code{true}, tic marks on the @var{x} axis are rotated
3451 Since this is a global graphics option, its position in the scene description
3454 @opencatbox{Categories:}
3455 @category{Package draw}
3461 @anchor{xtics_rotate_secondary}
3462 @defvr {Graphic option} xtics_rotate_secondary
3463 Default value: @code{false}
3465 If @code{xtics_rotate_secondary} is @code{true}, tic marks on the secondary @var{x} axis are rotated
3468 Since this is a global graphics option, its position in the scene description
3471 @opencatbox{Categories:}
3472 @category{Package draw}
3479 @anchor{xtics_secondary}
3480 @defvr {Graphic option} xtics_secondary
3481 Default value: @code{auto}
3483 This graphic option controls the way tic marks are drawn on the second @var{x} axis.
3485 See @mref{xtics_draw} for a complete description.
3487 @opencatbox{Categories:}
3488 @category{Package draw}
3495 @anchor{xtics_secondary_axis}
3496 @defvr {Graphic option} xtics_secondary_axis
3497 Default value: @code{false}
3499 If @code{xtics_secondary_axis} is @code{true}, tic marks and their labels are plotted just
3500 along the secondary @var{x} axis, if it is @code{false} tics are plotted on the border.
3502 Since this is a global graphics option, its position in the scene description
3505 @opencatbox{Categories:}
3506 @category{Package draw}
3514 @defvr {Graphic option} xu_grid
3517 @code{xu_grid} is the number of coordinates of the first variable
3518 (@code{x} in explicit and @code{u} in parametric 3d surfaces) to
3519 build the grid of sample points.
3521 This option affects the following graphic objects:
3524 @code{gr3d}: @code{explicit} and @code{parametric_surface}.
3530 (%i1) draw3d(xu_grid = 10,
3532 explicit(x^2+y^2,x,-3,3,y,-3,3) )$
3535 See also @mrefdot{yv_grid}
3537 @opencatbox{Categories:}
3538 @category{Package draw}
3547 @defvr {Graphic option} xy_file
3548 Default value: @code{""} (empty string)
3550 @code{xy_file} is the name of the file where the coordinates will be saved
3551 after clicking with the mouse button and hitting the 'x' key. By default,
3552 no coordinates are saved.
3554 Since this is a global graphics option, its position in the scene description
3557 @opencatbox{Categories:}
3558 @category{Package draw}
3567 @defvr {Graphic option} xyplane
3568 Default value: @code{false}
3570 Allocates the xy-plane in 3D scenes. When @code{xyplane} is
3571 @code{false}, the xy-plane is placed automatically; when it is
3572 a real number, the xy-plane intersects the z-axis at this level.
3573 This option has no effect in 2D scenes.
3575 Since this is a global graphics option, its position in the scene description
3581 (%i1) draw3d(xyplane = %e-2,
3582 explicit(x^2+y^2,x,-1,1,y,-1,1))$
3585 @opencatbox{Categories:}
3586 @category{Package draw}
3595 @defvr {Graphic option} y_voxel
3598 @code{y_voxel} is the number of voxels in the y direction to
3599 be used by the @i{marching cubes algorithm} implemented
3600 by the 3d @code{implicit} object. It is also used by graphic
3601 object @mrefdot{region}
3603 @opencatbox{Categories:}
3604 @category{Package draw}
3612 @defvr {Graphic option} yaxis
3613 Default value: @code{false}
3615 If @code{yaxis} is @code{true}, the @var{y} axis is drawn.
3617 Since this is a global graphics option, its position in the scene description
3623 (%i1) draw2d(explicit(x^3,x,-1,1),
3625 yaxis_color = blue)$
3628 See also @mrefcomma{yaxis_width} @mref{yaxis_type} and @mrefdot{yaxis_color}
3630 @opencatbox{Categories:}
3631 @category{Package draw}
3638 @anchor{yaxis_color}
3639 @defvr {Graphic option} yaxis_color
3640 Default value: @code{"black"}
3642 @code{yaxis_color} specifies the color for the @var{y} axis. See
3643 @code{color} to know how colors are defined.
3645 Since this is a global graphics option, its position in the scene description
3651 (%i1) draw2d(explicit(x^3,x,-1,1),
3656 See also @mrefcomma{yaxis} @mref{yaxis_width} and @mrefdot{yaxis_type}
3658 @opencatbox{Categories:}
3659 @category{Package draw}
3666 @anchor{yaxis_secondary}
3667 @defvr {Graphic option} yaxis_secondary
3668 Default value: @code{false}
3670 If @code{yaxis_secondary} is @code{true}, function values can be plotted with
3671 respect to the second @var{y} axis, which will be drawn on the right side of the
3674 Note that this is a local graphics option which only affects to 2d plots.
3680 explicit(sin(x),x,0,10),
3681 yaxis_secondary = true,
3682 ytics_secondary = true,
3684 explicit(100*sin(x+0.1)+2,x,0,10));
3687 See also @mrefcomma{yrange_secondary} @mrefcomma{ytics_secondary} @mref{ytics_rotate_secondary}
3688 and @code{ytics_axis_secondary}
3689 @c TODO: Document ytics_axis_secondary
3691 @opencatbox{Categories:}
3692 @category{Package draw}
3700 @defvr {Graphic option} yaxis_type
3701 Default value: @code{dots}
3703 @code{yaxis_type} indicates how the @var{y} axis is displayed;
3704 possible values are @code{solid} and @code{dots}.
3706 Since this is a global graphics option, its position in the scene description
3712 (%i1) draw2d(explicit(x^3,x,-1,1),
3714 yaxis_type = solid)$
3717 See also @mrefcomma{yaxis} @mref{yaxis_width} and @mrefdot{yaxis_color}
3719 @opencatbox{Categories:}
3720 @category{Package draw}
3727 @anchor{yaxis_width}
3728 @defvr {Graphic option} yaxis_width
3731 @code{yaxis_width} is the width of the @var{y} axis.
3732 Its value must be a positive number.
3734 Since this is a global graphics option, its position in the scene description
3740 (%i1) draw2d(explicit(x^3,x,-1,1),
3745 See also @mrefcomma{yaxis} @mref{yaxis_type} and @mrefdot{yaxis_color}
3747 @opencatbox{Categories:}
3748 @category{Package draw}
3755 @anchor{ylabel_draw}
3756 @defvr {Graphic option} ylabel
3757 Default value: @code{""}
3759 Option @code{ylabel}, a string, is the label for the @var{y} axis.
3760 By default, the axis is labeled with string @code{"y"}.
3762 Since this is a global graphics option, its position in the scene description
3768 (%i1) draw2d(xlabel = "Time",
3769 ylabel = "Population",
3770 explicit(exp(u),u,-2,2) )$
3773 See also @mrefcomma{xlabel_draw} @mrefcomma{xlabel_secondary} @mrefcomma{ylabel_secondary} and @mrefdot{zlabel_draw}
3775 @opencatbox{Categories:}
3776 @category{Package draw}
3783 @anchor{ylabel_secondary}
3784 @defvr {Graphic option} ylabel_secondary
3785 Default value: @code{""} (empty string)
3787 Option @code{ylabel_secondary}, a string, is the label for the secondary @var{y} axis.
3788 By default, no label is written.
3790 Since this is a global graphics option, its position in the scene description
3797 key_pos=bottom_right,
3800 ylabel="I[A]",ylabel_secondary="P[W]",
3801 explicit(sin(t),t,0,10),
3802 yaxis_secondary=true,
3803 ytics_secondary=true,
3804 color=red,key="Power",
3805 explicit((sin(t))^2,t,0,10)
3809 See also @mrefcomma{xlabel_draw} @mrefcomma{xlabel_secondary} @mref{ylabel_draw} and @mrefdot{zlabel_draw}
3811 @opencatbox{Categories:}
3812 @category{Package draw}
3820 @defvr {Graphic option} yrange
3821 Default value: @code{auto}
3823 If @code{yrange} is @code{auto}, the range for the @var{y} coordinate is
3824 computed automatically.
3826 If the user wants a specific interval for @var{y}, it must be given as a
3827 Maxima list, as in @code{yrange=[-2, 3]}.
3829 Since this is a global graphics option, its position in the scene description
3835 (%i1) draw2d(yrange = [-2,3],
3836 explicit(x^2,x,-1,1),
3840 See also @mrefcomma{xrange} @mref{yrange_secondary} and @mrefdot{zrange}
3842 @opencatbox{Categories:}
3843 @category{Package draw}
3850 @anchor{yrange_secondary}
3851 @defvr {Graphic option} yrange_secondary
3852 Default value: @code{auto}
3854 If @code{yrange_secondary} is @code{auto}, the range for the second @var{y} axis is
3855 computed automatically.
3857 If the user wants a specific interval for the second @var{y} axis, it must be given as a
3858 Maxima list, as in @code{yrange_secondary=[-2, 3]}.
3860 Since this is a global graphics option, its position in the scene description
3867 explicit(sin(x),x,0,10),
3868 yaxis_secondary = true,
3869 ytics_secondary = true,
3871 yrange_secondary = [-20, 20],
3873 explicit(100*sin(x+0.1)+2,x,0,10)) $
3876 See also @mrefcomma{xrange} @mref{yrange} and @mrefdot{zrange}
3878 @opencatbox{Categories:}
3879 @category{Package draw}
3886 @defvr {Graphic option} ytics
3887 Default value: @code{true}
3889 This graphic option controls the way tic marks are drawn on the @var{y} axis.
3891 See @code{xtics} for a complete description.
3893 @opencatbox{Categories:}
3894 @category{Package draw}
3902 @defvr {Graphic option} ytics_axis
3903 Default value: @code{false}
3905 If @code{ytics_axis} is @code{true}, tic marks and their labels are plotted just
3906 along the @var{y} axis, if it is @code{false} tics are plotted on the border.
3908 Since this is a global graphics option, its position in the scene description
3911 @opencatbox{Categories:}
3912 @category{Package draw}
3920 @anchor{ytics_rotate}
3921 @defvr {Graphic option} ytics_rotate
3922 Default value: @code{false}
3924 If @code{ytics_rotate} is @code{true}, tic marks on the @var{y} axis are rotated
3927 Since this is a global graphics option, its position in the scene description
3930 @opencatbox{Categories:}
3931 @category{Package draw}
3938 @anchor{ytics_rotate_secondary}
3939 @defvr {Graphic option} ytics_rotate_secondary
3940 Default value: @code{false}
3942 If @code{ytics_rotate_secondary} is @code{true}, tic marks on the secondary @var{y} axis are rotated
3945 Since this is a global graphics option, its position in the scene description
3948 @opencatbox{Categories:}
3949 @category{Package draw}
3956 @anchor{ytics_secondary}
3957 @defvr {Graphic option} ytics_secondary
3958 Default value: @code{auto}
3960 This graphic option controls the way tic marks are drawn on the second @var{y} axis.
3962 See @code{xtics} for a complete description.
3964 @opencatbox{Categories:}
3965 @category{Package draw}
3972 @anchor{ytics_secondary_axis}
3973 @defvr {Graphic option} ytics_secondary_axis
3974 Default value: @code{false}
3976 If @code{ytics_secondary_axis} is @code{true}, tic marks and their labels are plotted just
3977 along the secondary @var{y} axis, if it is @code{false} tics are plotted on the border.
3979 Since this is a global graphics option, its position in the scene description
3982 @opencatbox{Categories:}
3983 @category{Package draw}
3991 @defvr {Graphic option} yv_grid
3994 @code{yv_grid} is the number of coordinates of the second variable
3995 (@code{y} in explicit and @code{v} in parametric 3d surfaces) to
3996 build the grid of sample points.
3998 This option affects the following graphic objects:
4001 @code{gr3d}: @mref{explicit} and @mref{parametric_surface}.
4007 (%i1) draw3d(xu_grid = 10,
4009 explicit(x^2+y^2,x,-3,3,y,-3,3) )$
4011 @figure{draw_xugrid}
4013 See also @mrefdot{xu_grid}
4015 @opencatbox{Categories:}
4016 @category{Package draw}
4023 @defvr {Graphic option} z_voxel
4026 @code{z_voxel} is the number of voxels in the z direction to
4027 be used by the @i{marching cubes algorithm} implemented
4028 by the 3d @code{implicit} object.
4030 @opencatbox{Categories:}
4031 @category{Package draw}
4038 @defvr {Graphic option} zaxis
4039 Default value: @code{false}
4041 If @code{zaxis} is @code{true}, the @var{z} axis is drawn in 3D plots.
4042 This option has no effect in 2D scenes.
4044 Since this is a global graphics option, its position in the scene description
4050 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4053 zaxis_color = blue)$
4056 See also @mrefcomma{zaxis_width} @mref{zaxis_type} and @mrefdot{zaxis_color}
4058 @opencatbox{Categories:}
4059 @category{Package draw}
4066 @anchor{zaxis_color}
4067 @defvr {Graphic option} zaxis_color
4068 Default value: @code{"black"}
4070 @code{zaxis_color} specifies the color for the @var{z} axis. See
4071 @code{color} to know how colors are defined.
4072 This option has no effect in 2D scenes.
4074 Since this is a global graphics option, its position in the scene description
4080 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4086 See also @mrefcomma{zaxis} @mref{zaxis_width} and @mrefdot{zaxis_type}
4088 @opencatbox{Categories:}
4089 @category{Package draw}
4097 @defvr {Graphic option} zaxis_type
4098 Default value: @code{dots}
4100 @code{zaxis_type} indicates how the @var{z} axis is displayed;
4101 possible values are @code{solid} and @code{dots}.
4102 This option has no effect in 2D scenes.
4104 Since this is a global graphics option, its position in the scene description
4110 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4112 zaxis_type = solid)$
4115 See also @mrefcomma{zaxis} @mref{zaxis_width} and @mrefdot{zaxis_color}
4117 @opencatbox{Categories:}
4118 @category{Package draw}
4126 @anchor{zaxis_width}
4127 @defvr {Graphic option} zaxis_width
4130 @code{zaxis_width} is the width of the @var{z} axis.
4131 Its value must be a positive number. This option has no effect in 2D scenes.
4133 Since this is a global graphics option, its position in the scene description
4139 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4145 See also @mrefcomma{zaxis} @mref{zaxis_type} and @mrefdot{zaxis_color}
4147 @opencatbox{Categories:}
4148 @category{Package draw}
4155 @anchor{zlabel_draw}
4156 @defvr {Graphic option} zlabel
4157 Default value: @code{""}
4159 Option @code{zlabel}, a string, is the label for the @var{z} axis.
4160 By default, the axis is labeled with string @code{"z"}.
4162 Since this is a global graphics option, its position in the scene description
4168 (%i1) draw3d(zlabel = "Z variable",
4169 ylabel = "Y variable",
4170 explicit(sin(x^2+y^2),x,-2,2,y,-2,2),
4171 xlabel = "X variable" )$
4174 See also @mrefcomma{xlabel_draw} @mrefcomma{ylabel_draw} and @mrefdot{zlabel_rotate}
4176 @opencatbox{Categories:}
4177 @category{Package draw}
4185 @anchor{zlabel_rotate}
4186 @defvr {Graphic option} zlabel_rotate
4187 Default value: @code{"auto"}
4189 This graphics option allows to choose if the z axis label of 3d plots is
4190 drawn horizontal (@code{false}), vertical (@code{true}) or if maxima
4191 automatically chooses an orientation based on the length of the label
4194 Since this is a global graphics option, its position in the scene description
4201 explicit(sin(x)*sin(y),x,0,10,y,0,10),
4206 See also @mrefdot{zlabel_draw}
4208 @opencatbox{Categories:}
4209 @category{Package draw}
4218 @defvr {Graphic option} zrange
4219 Default value: @code{auto}
4221 If @code{zrange} is @code{auto}, the range for the @var{z} coordinate is
4222 computed automatically.
4224 If the user wants a specific interval for @var{z}, it must be given as a
4225 Maxima list, as in @code{zrange=[-2, 3]}.
4227 Since this is a global graphics option, its position in the scene description
4233 (%i1) draw3d(yrange = [-3,3],
4235 explicit(x^2+y^2,x,-1,1,y,-1,1),
4239 See also @mref{xrange} and @mrefdot{yrange}
4241 @opencatbox{Categories:}
4242 @category{Package draw}
4248 @defvr {Graphic option} ztics
4249 Default value: @code{true}
4251 This graphic option controls the way tic marks are drawn on the @var{z} axis.
4253 See @mref{xtics_draw} for a complete description.
4255 @opencatbox{Categories:}
4256 @category{Package draw}
4265 @defvr {Graphic option} ztics_axis
4266 Default value: @code{false}
4268 If @code{ztics_axis} is @code{true}, tic marks and their labels are plotted just
4269 along the @var{z} axis, if it is @code{false} tics are plotted on the border.
4271 Since this is a global graphics option, its position in the scene description
4274 @opencatbox{Categories:}
4275 @category{Package draw}
4281 @anchor{ztics_rotate}
4282 @defvr {Graphic option} ztics_rotate
4283 Default value: @code{false}
4285 If @code{ztics_rotate} is @code{true}, tic marks on the @var{z} axis are rotated
4288 Since this is a global graphics option, its position in the scene description
4291 @opencatbox{Categories:}
4292 @category{Package draw}
4300 @subsection Graphics objects
4305 @deffn {Graphic object} bars ([@var{x1},@var{h1},@var{w1}], [@var{x2},@var{h2},@var{w2}, ...])
4306 Draws vertical bars in 2D.
4310 @code{bars ([@var{x1},@var{h1},@var{w1}], [@var{x2},@var{h2},@var{w2}, ...])}
4311 draws bars centered at values @var{x1}, @var{x2}, ... with heights @var{h1}, @var{h2}, ...
4312 and widths @var{w1}, @var{w2}, ...
4314 This object is affected by the following @i{graphic options}: @mrefcomma{key}
4315 @mrefcomma{fill_color} @mref{fill_density} and @mrefdot{line_width}
4324 bars([0.8,5,0.4],[1.8,7,0.4],[2.8,-4,0.4]),
4329 bars([1.2,4,0.4],[2.2,-2,0.4],[3.2,5,0.4]),
4334 @opencatbox{Categories:}
4335 @category{Package draw}
4342 @anchor{cylindrical}
4343 @deffn {Graphic object} cylindrical (@var{radius}, @var{z}, @var{minz}, @var{maxz}, @var{azi}, @var{minazi}, @var{maxazi})
4344 Draws 3D functions defined in cylindrical coordinates.
4348 @code{cylindrical(@var{radius}, @var{z}, @var{minz}, @var{maxz}, @var{azi},
4349 @var{minazi}, @var{maxazi})} plots the function @code{@var{radius}(@var{z},
4350 @var{azi})} defined in cylindrical coordinates, with variable @var{z} taking
4351 values from @var{minz} to @var{maxz} and @i{azimuth} @var{azi} taking values
4352 from @var{minazi} to @var{maxazi}.
4354 This object is affected by the following @i{graphic options}: @mrefcomma{xu_grid}
4355 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{key} @mrefcomma{wired_surface} @code{enhanced3d} and @code{color}
4360 (%i1) draw3d(cylindrical(1,z,-2,2,az,0,2*%pi))$
4362 @figure{draw_cylindrical}
4364 @opencatbox{Categories:}
4365 @category{Package draw}
4373 @anchor{elevation_grid}
4374 @deffn {Graphic object} elevation_grid (@var{mat},@var{x0},@var{y0},@var{width},@var{height})
4375 Draws matrix @var{mat} in 3D space. @var{z} values are taken from @var{mat},
4376 the abscissas range from @var{x0} to @math{@var{x0} + @var{width}}
4377 and ordinates from @var{y0} to @math{@var{y0} + @var{height}}. Element @math{a(1,1)}
4378 is projected on point @math{(x0,y0+height)}, @math{a(1,n)} on @math{(x0+width,y0+height)},
4379 @math{a(m,1)} on @math{(x0,y0)}, and @math{a(m,n)} on @math{(x0+width,y0)}.
4381 This object is affected by the following @i{graphic options}: @mrefcomma{line_type},
4382 @mref{line_width} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d} and @code{color}
4384 In older versions of Maxima, @mref{elevation_grid} was called @mrefdot{mesh}
4385 See also @mrefdot{mesh}
4392 makelist(makelist(random(10.0),k,1,30),i,1,20)) $
4395 elevation_grid(m,0,0,3,2),
4398 surface_hide = true);
4400 @figure{draw_elevation_grid}
4402 @opencatbox{Categories:}
4403 @category{Package draw}
4412 @deffn {Graphic object} ellipse (@var{xc}, @var{yc}, @var{a}, @var{b}, @var{ang1}, @var{ang2})
4413 Draws ellipses and circles in 2D.
4418 @code{ellipse (@var{xc}, @var{yc}, @var{a}, @var{b}, @var{ang1}, @var{ang2})}
4419 plots an ellipse centered at @code{[@var{xc}, @var{yc}]} with horizontal and vertical
4420 semi axis @var{a} and @var{b}, respectively, starting at angle @var{ang1} with an amplitude
4421 equal to angle @var{ang2}.
4423 This object is affected by the following @i{graphic options}: @mrefcomma{nticks}
4424 @mrefcomma{transparent} @mrefcomma{fill_color} @mrefcomma{fill_density} @mrefcomma{border} @code{line_width},
4425 @mrefcomma{line_type} @mref{key} and @code{color}
4430 (%i1) draw2d(transparent = false,
4433 transparent = false,
4435 ellipse(0,6,3,2,270,-270),
4436 /* center (x,y), a, b, start & end in degrees */
4440 ellipse(2.5,6,2,3,30,-90),
4444 @figure{draw_ellipse}
4446 @opencatbox{Categories:}
4447 @category{Package draw}
4454 @deffn {Graphic object} errors ([@var{x1}, @var{x2}, @dots{}], [@var{y1}, @var{y2}, @dots{}])
4455 Draws points with error bars, horizontally, vertically or both, depending on the
4456 value of option @code{error_type}.
4460 If @code{error_type = x}, arguments to @code{errors} must be of the form
4461 @code{[x, y, xdelta]} or @code{[x, y, xlow, xhigh]}. If @code{error_type = y},
4462 arguments must be of the form @code{[x, y, ydelta]} or
4463 @code{[x, y, ylow, yhigh]}. If @code{error_type = xy} or
4464 @code{error_type = boxes}, arguments to @code{errors} must be of the form
4465 @code{[x, y, xdelta, ydelta]} or @code{[x, y, xlow, xhigh, ylow, yhigh]}.
4467 See also @mrefdot{error_type}
4469 This object is affected by the following @i{graphic options}: @mrefcomma{error_type}
4470 @mrefcomma{points_joined} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{line_type}
4471 @code{color} @mrefcomma{fill_density} @mref{xaxis_secondary} and @mrefdot{yaxis_secondary}
4473 Option @mref{fill_density} is only relevant when @code{error_type=boxes}.
4477 Horizontal error bars.
4482 errors([[1,2,1], [3,5,3], [10,3,1], [17,6,2]]))$
4484 @figure{draw_errors}
4486 Vertical and horizontal error bars.
4491 points_joined = true,
4493 errors([[1,2,1,2], [3,5,2,1], [10,3,1,1], [17,6,1/2,2]]));
4495 @figure{draw_errors2}
4497 @opencatbox{Categories:}
4498 @category{Package draw}
4505 @deffn {Graphic object} explicit @
4506 @fname{explicit} (@var{expr},@var{var},@var{minval},@var{maxval}) @
4507 @fname{explicit} (@var{fcn},@var{var},@var{minval},@var{maxval}) @
4508 @fname{explicit} (@var{expr},@var{var1},@var{minval1},@var{maxval1},@var{var2},@var{minval2},@var{maxval2}) @
4509 @fname{explicit} (@var{fcn},@var{var1},@var{minval1},@var{maxval1},@var{var2},@var{minval2},@var{maxval2})
4511 Draws explicit functions in 2D and 3D.
4515 @code{explicit(@var{fcn},@var{var},@var{minval},@var{maxval})} plots explicit function @var{fcn},
4516 with variable @var{var} taking values from @var{minval} to @var{maxval}.
4518 This object is affected by the following @i{graphic options}: @mrefcomma{nticks}
4519 @code{adapt_depth}, @mrefcomma{draw_realpart} @mrefcomma{line_width} @mrefcomma{line_type} @mrefcomma{key}
4520 @mrefcomma{filled_func} @mrefcomma{fill_color} @mrefcomma{fill_density} and @code{color}
4525 (%i1) draw2d(line_width = 3,
4527 explicit(x^2,x,-3,3) )$
4529 @figure{draw_explicit}
4531 (%i2) draw2d(fill_color = brown,
4533 explicit(x^2,x,-3,3) )$
4535 @figure{draw_explicit2}
4539 @code{explicit(@var{fcn}, @var{var1}, @var{minval1}, @var{maxval1}, @var{var2},
4540 @var{minval2}, @var{maxval2})} plots the explicit function @var{fcn}, with
4541 variable @var{var1} taking values from @var{minval1} to @var{maxval1} and
4542 variable @var{var2} taking values from @var{minval2} to @var{maxval2}.
4544 This object is affected by the following @i{graphic options}: @mrefcomma{draw_realpart} @mrefcomma{xu_grid}
4545 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{wired_surface}
4546 @mref{enhanced3d} and @code{color}.
4551 (%i1) draw3d(key = "Gauss",
4553 explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3),
4557 explicit(x+y,x,-5,5,y,-5,5),
4558 surface_hide = true)$
4560 @figure{draw_explicit3}
4562 See also @mref{filled_func} for filled functions.
4564 @opencatbox{Categories:}
4565 @category{Package draw}
4573 @deffn {Graphic object} image (@var{im},@var{x0},@var{y0},@var{width},@var{height})
4574 Renders images in 2D.
4578 @code{image (@var{im},@var{x0},@var{y0},@var{width},@var{height})} plots image @var{im} in the rectangular
4579 region from vertex @code{(@var{x0},@var{y0})} to @code{(x0+@var{width},y0+@var{height})} on the real
4580 plane. Argument @var{im} must be a matrix of real numbers, a matrix of
4581 vectors of length three or a @var{picture} object.
4583 If @var{im} is a matrix of real numbers or a @var{levels picture} object,
4584 pixel values are interpreted according to graphic option @code{palette},
4585 which is a vector of length three with components
4586 ranging from -36 to +36; each value is an index for a formula mapping the levels
4587 onto red, green and blue colors, respectively:
4591 6: x^4 7: sqrt(x) 8: sqrt(sqrt(x))
4592 9: sin(90x) 10: cos(90x) 11: |x-0.5|
4593 12: (2x-1)^2 13: sin(180x) 14: |cos(180x)|
4594 15: sin(360x) 16: cos(360x) 17: |sin(360x)|
4595 18: |cos(360x)| 19: |sin(720x)| 20: |cos(720x)|
4596 21: 3x 22: 3x-1 23: 3x-2
4597 24: |3x-1| 25: |3x-2| 26: (3x-1)/2
4598 27: (3x-2)/2 28: |(3x-1)/2| 29: |(3x-2)/2|
4599 30: x/0.32-0.78125 31: 2*x-0.84
4600 32: 4x;1;-2x+1.84;x/0.08-11.5
4601 33: |2*x - 0.5| 34: 2*x 35: 2*x - 0.5
4604 negative numbers mean negative colour component.
4606 @code{palette = gray} and @code{palette = color} are short cuts for
4607 @code{palette = [3,3,3]} and @code{palette = [7,5,15]}, respectively.
4609 If @var{im} is a matrix of vectors of length three or an @var{rgb picture} object,
4610 they are interpreted as red, green and blue color components.
4614 If @var{im} is a matrix of real numbers, pixel values are interpreted according
4615 to graphic option @code{palette}.
4619 makelist(makelist(random(200),i,1,30),i,1,30))$
4620 (%i2) /* palette = color, default */
4621 draw2d(image(im,0,0,30,30))$
4625 (%i3) draw2d(palette = gray, image(im,0,0,30,30))$
4627 @figure{draw_image2}
4629 (%i4) draw2d(palette = [15,20,-4],
4631 image(im,0,0,30,30))$
4633 @figure{draw_image3}
4635 See also @mrefdot{colorbox}
4637 If @var{im} is a matrix of vectors of length three, they are interpreted
4638 as red, green and blue color components.
4643 makelist([random(300),
4645 random(300)],i,1,30),i,1,30))$
4646 (%i2) draw2d(image(im,0,0,30,30))$
4648 @figure{draw_image4}
4650 Package @code{draw} automatically loads package @code{picture}. In this
4651 example, a level picture object is built by hand and then rendered.
4653 (%i1) im: make_level_picture([45,87,2,134,204,16],3,2);
4654 (%o1) picture(level, 3, 2, @{Array: #(45 87 2 134 204 16)@})
4655 (%i2) /* default color palette */
4656 draw2d(image(im,0,0,30,30))$
4658 @figure{draw_image5}
4660 (%i3) /* gray palette */
4661 draw2d(palette = gray,
4662 image(im,0,0,30,30))$
4664 @figure{draw_image6}
4666 An xpm file is read and then rendered.
4668 (%i1) im: read_xpm("myfile.xpm")$
4669 (%i2) draw2d(image(im,0,0,10,7))$
4672 See also @mrefcomma{make_level_picture} @mref{make_rgb_picture} and @mrefdot{read_xpm}
4674 @url{http://www.telefonica.net/web2/biomates/maxima/gpdraw/image}@*
4675 contains more elaborated examples.
4677 @opencatbox{Categories:}
4678 @category{Package draw}
4687 @deffn {Graphic object} implicit @
4688 @fname{implicit} (@var{fcn},@var{x},@var{xmin},@var{xmax},@var{y},@var{ymin},@var{ymax}) @
4689 @fname{implicit} (@var{fcn},@var{x},@var{xmin},@var{xmax},@var{y},@var{ymin},@var{ymax},@var{z},@var{zmin},@var{zmax})
4691 Draws implicit functions in 2D and 3D.
4695 @code{implicit(@var{fcn},@var{x},@var{xmin},@var{xmax},@var{y},@var{ymin},@var{ymax})}
4696 plots the implicit function defined by @var{fcn}, with variable @var{x} taking values
4697 from @var{xmin} to @var{xmax}, and variable @var{y} taking values
4698 from @var{ymin} to @var{ymax}.
4700 This object is affected by the following @i{graphic options}: @mrefcomma{ip_grid}
4701 @mrefcomma{ip_grid_in} @mrefcomma{line_width} @mrefcomma{line_type} @mref{key} and @code{color}.
4706 (%i1) draw2d(grid = true,
4708 key = "y^2=x^3-2*x+1",
4709 implicit(y^2=x^3-2*x+1, x, -4,4, y, -4,4),
4711 key = "x^3+y^3 = 3*x*y^2-x-1",
4712 implicit(x^3+y^3 = 3*x*y^2-x-1, x,-4,4, y,-4,4),
4713 title = "Two implicit functions" )$
4715 @figure{draw_implicit}
4719 @code{implicit (@var{fcn},@var{x},@var{xmin},@var{xmax}, @var{y},@var{ymin},@var{ymax}, @var{z},@var{zmin},@var{zmax})}
4720 plots the implicit surface defined by @var{fcn}, with variable @var{x} taking values
4721 from @var{xmin} to @var{xmax}, variable @var{y} taking values
4722 from @var{ymin} to @var{ymax} and variable @var{z} taking values
4723 from @var{zmin} to @var{zmax}. This object implements the @i{marching cubes algorithm}.
4725 This object is affected by the following @i{graphic options}: @mrefcomma{x_voxel}
4726 @mrefcomma{y_voxel} @mrefcomma{z_voxel} @mrefcomma{line_width} @mrefcomma{line_type} @mrefcomma{key}
4727 @mrefcomma{wired_surface} @mref{enhanced3d} and @code{color}.
4734 implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015,
4735 x,-1,1,y,-1.2,2.3,z,-1,1),
4738 @figure{draw_implicit2}
4740 @opencatbox{Categories:}
4741 @category{Package draw}
4748 @deffn {Graphic object} label @
4749 @fname{label} ([@var{string},@var{x},@var{y}],...) @
4750 @fname{label} ([@var{string},@var{x},@var{y},@var{z}],...)
4752 Writes labels in 2D and 3D.
4754 Colored labels work only with Gnuplot 4.3 and up.
4756 This object is affected by the following @i{graphic options}: @mrefcomma{label_alignment}
4757 @mref{label_orientation} and @code{color}.
4761 @code{label([@var{string},@var{x},@var{y}])} writes the @var{string} at point
4762 @code{[@var{x},@var{y}]}.
4767 (%i1) draw2d(yrange = [0.1,1.4],
4769 label(["Label in red",0,0.3]),
4771 label(["Label in blue",0,0.6]),
4773 label(["Label in light-blue",0,0.9],
4774 ["Another light-blue",0,1.2]) )$
4780 @code{label([@var{string},@var{x},@var{y},@var{z}])} writes the @var{string} at point
4781 @code{[@var{x},@var{y},@var{z}]}.
4786 (%i1) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3),
4788 label(["UP 1",-2,0,3], ["UP 2",1.5,0,4]),
4790 label(["DOWN 1",2,0,-3]) )$
4792 @figure{draw_label2}
4794 @opencatbox{Categories:}
4795 @category{Package draw}
4802 @deffn {Graphic object} mesh (@var{row_1},@var{row_2},...)
4803 Draws a quadrangular mesh in 3D.
4807 Argument @var{row_i} is a list of @var{n} 3D points of the form
4808 @code{[[x_i1,y_i1,z_i1], ...,[x_in,y_in,z_in]]}, and all rows are
4809 of equal length. All these points define an arbitrary surface in 3D and
4810 in some sense it's a generalization of the @code{elevation_grid} object.
4812 This object is affected by the following @i{graphic options}: @mrefcomma{line_type}
4813 @mrefcomma{line_width} @mrefcomma{color} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d} and @mrefdot{transform}
4821 mesh([[1,1,3], [7,3,1],[12,-2,4],[15,0,5]],
4822 [[2,7,8], [4,3,1],[10,5,8], [12,7,1]],
4823 [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
4827 Plotting a triangle in 3D.
4832 mesh([[1,0,0],[0,1,0]],
4833 [[0,0,1],[0,0,1]])) $
4841 surface_hide = true,
4844 mesh([[0,0,0], [0,1,0]],
4845 [[2,0,2], [2,2,2]]),
4847 mesh([[0,0,2], [0,1,2]],
4848 [[2,0,4], [2,2,4]])) $
4852 @opencatbox{Categories:}
4853 @category{Package draw}
4860 @deffn {Graphic object} parametric @
4861 @fname{parametric} (@var{xfun},@var{yfun},@var{par},@var{parmin},@var{parmax}) @
4862 @fname{parametric} (@var{xfun},@var{yfun},@var{zfun},@var{par},@var{parmin},@var{parmax})
4864 Draws parametric functions in 2D and 3D.
4866 This object is affected by the following @i{graphic options}: @mrefcomma{nticks}
4867 @mrefcomma{line_width} @mrefcomma{line_type} @mrefcomma{key} @mref{color} and @mrefdot{enhanced3d}
4871 The command @code{parametric(@var{xfun}, @var{yfun}, @var{par}, @var{parmin},
4872 @var{parmax})} plots the parametric function @code{[@var{xfun}, @var{yfun}]},
4873 with parameter @var{par} taking values from @var{parmin} to @var{parmax}.
4878 (%i1) draw2d(explicit(exp(x),x,-1,3),
4880 key = "This is the parametric one!!",
4881 parametric(2*cos(rrr),rrr^2,rrr,0,2*%pi))$
4883 @figure{draw_parametric}
4887 @code{parametric(@var{xfun}, @var{yfun}, @var{zfun}, @var{par}, @var{parmin},
4888 @var{parmax})} plots the parametric curve @code{[@var{xfun}, @var{yfun},
4889 @var{zfun}]}, with parameter @var{par} taking values from @var{parmin} to
4895 (%i1) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3),
4897 parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2),
4900 parametric(t^2,sin(t),2+t,t,0,2),
4901 surface_hide = true,
4902 title = "Surface & curves" )$
4904 @figure{draw_parametric2}
4906 @opencatbox{Categories:}
4907 @category{Package draw}
4914 @anchor{parametric_surface}
4915 @deffn {Graphic object} parametric_surface (@var{xfun}, @var{yfun}, @var{zfun}, @var{par1}, @var{par1min}, @var{par1max}, @var{par2}, @var{par2min}, @var{par2max})
4916 Draws parametric surfaces in 3D.
4920 The command @code{parametric_surface(@var{xfun}, @var{yfun}, @var{zfun},
4921 @var{par1}, @var{par1min}, @var{par1max}, @var{par2}, @var{par2min},
4922 @var{par2max})} plots the parametric surface @code{[@var{xfun}, @var{yfun},
4923 @var{zfun}]}, with parameter @var{par1} taking values from @var{par1min} to
4924 @var{par1max} and parameter @var{par2} taking values from @var{par2min} to
4927 This object is affected by the following @i{graphic options}: @mrefcomma{draw_realpart} @mrefcomma{xu_grid}
4928 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d}
4934 (%i1) draw3d(title = "Sea shell",
4938 surface_hide = true,
4939 parametric_surface(0.5*u*cos(u)*(cos(v)+1),
4940 0.5*u*sin(u)*(cos(v)+1),
4941 u*sin(v) - ((u+3)/8*%pi)^2 - 20,
4942 u, 0, 13*%pi, v, -%pi, %pi) )$
4944 @figure{draw_parametric3}
4946 @opencatbox{Categories:}
4947 @category{Package draw}
4955 @deffn {Graphic object} points @
4956 @fname{points} ([[@var{x1},@var{y1}], [@var{x2},@var{y2}],...]) @
4957 @fname{points} ([@var{x1},@var{x2},...], [@var{y1},@var{y2},...]) @
4958 @fname{points} ([@var{y1},@var{y2},...]) @
4959 @fname{points} ([[@var{x1},@var{y1},@var{z1}], [@var{x2},@var{y2},@var{z2}],...]) @
4960 @fname{points} ([@var{x1},@var{x2},...], [@var{y1},@var{y2},...], [@var{z1},@var{z2},...]) @
4961 @fname{points} (@var{matrix}) @
4962 @fname{points} (@var{1d_y_array}) @
4963 @fname{points} (@var{1d_x_array}, @var{1d_y_array}) @
4964 @fname{points} (@var{1d_x_array}, @var{1d_y_array}, @var{1d_z_array}) @
4965 @fname{points} (@var{2d_xy_array}) @
4966 @fname{points} (@var{2d_xyz_array})
4968 Draws points in 2D and 3D.
4970 This object is affected by the following @i{graphic options}: @mrefcomma{point_size}
4971 @mrefcomma{point_type} @mrefcomma{points_joined} @mrefcomma{line_width} @mrefcomma{key}
4972 @mref{line_type} and @code{color}. In 3D mode, it is also affected by @mref{enhanced3d}
4976 @code{points ([[@var{x1},@var{y1}], [@var{x2},@var{y2}],...])} or
4977 @code{points ([@var{x1},@var{x2},...], [@var{y1},@var{y2},...])}
4978 plots points @code{[x1,y1]}, @code{[x2,y2]}, etc. If abscissas
4979 are not given, they are set to consecutive positive integers, so that
4980 @code{points ([@var{y1},@var{y2},...])} draws points @code{[1,@var{y1}]}, @code{[2,@var{y2}]}, etc.
4981 If @var{matrix} is a two-column or two-row matrix, @code{points (@var{matrix})}
4982 draws the associated points. If @var{matrix} is an one-column or one-row matrix,
4983 abscissas are assigned automatically.
4985 If @var{1d_y_array} is a 1D lisp array of numbers, @code{points (@var{1d_y_array})} plots them
4986 setting abscissas to consecutive positive integers. @code{points (@var{1d_x_array}, @var{1d_y_array})}
4987 plots points with their coordinates taken from the two arrays passed as arguments. If
4988 @var{2d_xy_array} is a 2D array with two columns, or with two rows, @code{points (@var{2d_xy_array})}
4989 plots the corresponding points on the plane.
4993 Two types of arguments for @code{points}, a list of pairs and two lists
4994 of separate coordinates.
4997 key = "Small points",
4998 points(makelist([random(20),random(50)],k,1,10)),
4999 point_type = circle,
5001 points_joined = true,
5002 key = "Great points",
5003 points(makelist(k,k,1,20),makelist(random(30),k,1,20)),
5004 point_type = filled_down_triangle,
5005 key = "Automatic abscissas",
5009 @figure{draw_points}
5014 points_joined = impulses,
5017 points(makelist([random(20),random(50)],k,1,10)))$
5019 @figure{draw_points2}
5021 Array with ordinates.
5023 (%i1) a: make_array (flonum, 100) $
5024 (%i2) for i:0 thru 99 do a[i]: random(1.0) $
5025 (%i3) draw2d(points(a)) $
5027 @figure{draw_points3}
5029 Two arrays with separate coordinates.
5031 (%i1) x: make_array (flonum, 100) $
5032 (%i2) y: make_array (fixnum, 100) $
5033 (%i3) for i:0 thru 99 do (
5035 y[i]: random(10) ) $
5036 (%i4) draw2d(points(x, y)) $
5038 @figure{draw_points4}
5040 A two-column 2D array.
5042 (%i1) xy: make_array(flonum, 100, 2) $
5043 (%i2) for i:0 thru 99 do (
5044 xy[i, 0]: float(i/100),
5045 xy[i, 1]: random(10) ) $
5046 (%i3) draw2d(points(xy)) $
5048 @figure{draw_points5}
5050 Drawing an array filled with function @code{read_array}.
5052 (%i1) a: make_array(flonum,100) $
5053 (%i2) read_array (file_search ("pidigits.data"), a) $
5054 (%i3) draw2d(points(a)) $
5059 @code{points([[@var{x1}, @var{y1}, @var{z1}], [@var{x2}, @var{y2}, @var{z2}],
5060 ...])} or @code{points([@var{x1}, @var{x2}, ...], [@var{y1}, @var{y2}, ...],
5061 [@var{z1}, @var{z2},...])} plots points @code{[@var{x1}, @var{y1}, @var{z1}]},
5062 @code{[@var{x2}, @var{y2}, @var{z2}]}, etc. If @var{matrix} is a three-column
5063 or three-row matrix, @code{points (@var{matrix})} draws the associated points.
5065 When arguments are lisp arrays, @code{points (@var{1d_x_array}, @var{1d_y_array}, @var{1d_z_array})}
5066 takes coordinates from the three 1D arrays. If @var{2d_xyz_array} is a 2D array with three columns,
5067 or with three rows, @code{points (@var{2d_xyz_array})} plots the corresponding points.
5071 One tridimensional sample,
5073 (%i1) load ("numericalio")$
5074 (%i2) s2 : read_matrix (file_search ("wind.data"))$
5075 (%i3) draw3d(title = "Daily average wind speeds",
5077 points(args(submatrix (s2, 4, 5))) )$
5080 Two tridimensional samples,
5082 (%i1) load ("numericalio")$
5083 (%i2) s2 : read_matrix (file_search ("wind.data"))$
5085 title = "Daily average wind speeds. Two data sets",
5087 key = "Sample from stations 1, 2 and 3",
5088 points(args(submatrix (s2, 4, 5))),
5090 key = "Sample from stations 1, 4 and 5",
5091 points(args(submatrix (s2, 2, 3))) )$
5094 Unidimensional arrays,
5096 (%i1) x: make_array (fixnum, 10) $
5097 (%i2) y: make_array (fixnum, 10) $
5098 (%i3) z: make_array (fixnum, 10) $
5099 (%i4) for i:0 thru 9 do (
5102 z[i]: random(10) ) $
5103 (%i5) draw3d(points(x,y,z)) $
5105 @figure{draw_points6}
5107 Bidimensional colored array,
5109 (%i1) xyz: make_array(fixnum, 10, 3) $
5110 (%i2) for i:0 thru 9 do (
5111 xyz[i, 0]: random(10),
5112 xyz[i, 1]: random(10),
5113 xyz[i, 2]: random(10) ) $
5116 points_joined = true,
5119 @figure{draw_points7}
5121 Color numbers explicitly specified by the user.
5123 (%i1) pts: makelist([t,t^2,cos(t)], t, 0, 15)$
5124 (%i2) col_num: makelist(k, k, 1, length(pts))$
5126 enhanced3d = ['part(col_num,k),k],
5128 point_type = filled_circle,
5131 @figure{draw_points8}
5133 @opencatbox{Categories:}
5134 @category{Package draw}
5142 @deffn {Graphic object} polar (@var{radius},@var{ang},@var{minang},@var{maxang})
5143 Draws 2D functions defined in polar coordinates.
5147 @code{polar (@var{radius},@var{ang},@var{minang},@var{maxang})} plots function
5148 @code{@var{radius}(@var{ang})} defined in polar coordinates, with variable
5149 @var{ang} taking values from
5150 @var{minang} to @var{maxang}.
5152 This object is affected by the following @i{graphic options}: @mrefcomma{nticks}
5153 @mrefcomma{line_width} @mrefcomma{line_type} @mref{key} and @code{color}.
5158 (%i1) draw2d(user_preamble = "set grid polar",
5164 title = "Hyperbolic Spiral",
5165 polar(10/theta,theta,1,10*%pi) )$
5169 @opencatbox{Categories:}
5170 @category{Package draw}
5179 @deffn {Graphic object} polygon @
5180 @fname{polygon} ([[@var{x1}, @var{y1}], [@var{x2}, @var{y2}], @dots{}]) @
5181 @fname{polygon} ([@var{x1}, @var{x2}, @dots{}], [@var{y1}, @var{y2}, @dots{}])
5183 Draws polygons in 2D.
5187 The commands @code{polygon([[@var{x1}, @var{y1}], [@var{x2}, @var{y2}], ...])}
5188 or @code{polygon([@var{x1}, @var{x2}, ...], [@var{y1}, @var{y2}, ...])} plot on
5189 the plane a polygon with vertices @code{[@var{x1}, @var{y1}]}, @code{[@var{x2},
5192 This object is affected by the following @i{graphic options}: @mrefcomma{transparent}
5193 @mrefcomma{fill_color} @mrefcomma{fill_density} @mrefcomma{border} @mrefcomma{line_width} @mrefcomma{key}
5194 @mref{line_type} and @code{color}.
5199 (%i1) draw2d(color = "#e245f0",
5201 polygon([[3,2],[7,2],[5,5]]),
5203 fill_color = yellow,
5204 polygon([[5,2],[9,2],[7,5]]) )$
5206 @figure{draw_polygon}
5208 @opencatbox{Categories:}
5209 @category{Package draw}
5215 @anchor{quadrilateral}
5216 @deffn {Graphic object} quadrilateral (@var{point_1}, @var{point_2}, @var{point_3}, @var{point_4})
5217 Draws a quadrilateral.
5221 @code{quadrilateral([@var{x1}, @var{y1}], [@var{x2}, @var{y2}],
5222 [@var{x3}, @var{y3}], [@var{x4}, @var{y4}])} draws a quadrilateral with vertices
5223 @code{[@var{x1}, @var{y1}]}, @code{[@var{x2}, @var{y2}]},
5224 @code{[@var{x3}, @var{y3}]}, and @code{[@var{x4}, @var{y4}]}.
5226 This object is affected by the following @i{graphic options}:@*
5227 @mrefcomma{transparent} @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width}
5228 @mrefcomma{key} @mrefcomma{xaxis_secondary} @mrefcomma{yaxis_secondary} @mrefcomma{line_type}
5229 @code{transform} and @code{color}.
5235 quadrilateral([1,1],[2,2],[3,-1],[2,-2]))$
5237 @figure{draw_quadrilateral}
5241 @code{quadrilateral([@var{x1}, @var{y1}, @var{z1}], [@var{x2}, @var{y2},
5242 @var{z2}], [@var{x3}, @var{y3}, @var{z3}], [@var{x4}, @var{y4}, @var{z4}])}
5243 draws a quadrilateral with vertices @code{[@var{x1}, @var{y1}, @var{z1}]},
5244 @code{[@var{x2}, @var{y2}, @var{z2}]}, @code{[@var{x3}, @var{y3}, @var{z3}]},
5245 and @code{[@var{x4}, @var{y4}, @var{z4}]}.
5247 This object is affected by the following @i{graphic options}: @mrefcomma{line_type}
5248 @mrefcomma{line_width} @mrefcomma{color} @mrefcomma{key} @mref{enhanced3d} and
5251 @opencatbox{Categories:}
5252 @category{Package draw}
5257 @deffn {Graphic object} rectangle ([@var{x1},@var{y1}], [@var{x2},@var{y2}])
5258 Draws rectangles in 2D.
5262 @code{rectangle ([@var{x1},@var{y1}], [@var{x2},@var{y2}])} draws a rectangle with opposite vertices
5263 @code{[@var{x1},@var{y1}]} and @code{[@var{x2},@var{y2}]}.
5265 This object is affected by the following @i{graphic options}: @mrefcomma{transparent}
5266 @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width} @mrefcomma{key}
5267 @mref{line_type} and @code{color}.
5272 (%i1) draw2d(fill_color = red,
5275 transparent = false,
5277 rectangle([-2,-2],[8,-1]), /* opposite vertices */
5281 rectangle([9,4],[2,-1.5]),
5283 yrange = [-3,4.5] )$
5285 @figure{draw_rectangle}
5287 @opencatbox{Categories:}
5288 @category{Package draw}
5297 @deffn {Graphic object} region (@var{expr},@var{var1},@var{minval1},@var{maxval1},@var{var2},@var{minval2},@var{maxval2})
5298 Plots a region on the plane defined by inequalities.
5301 @var{expr} is an expression formed by inequalities and boolean operators
5302 @code{and}, @code{or}, and @mrefdot{not} The region is bounded by the rectangle
5303 defined by @math{[@var{minval1}, @var{maxval1}]} and @math{[@var{minval2}, @var{maxval2}]}.
5305 This object is affected by the following @i{graphic options}: @mrefcomma{fill_color} @mrefcomma{fill_density}
5306 @mrefcomma{key} @mref{x_voxel} and @mrefdot{y_voxel}
5314 region(x^2+y^2<1 and x^2+y^2 > 1/2,
5315 x, -1.5, 1.5, y, -1.5, 1.5));
5318 @figure{draw_region}
5322 @deffn {Graphic object} spherical (@var{radius}, @var{azi}, @var{minazi}, @var{maxazi}, @var{zen}, @var{minzen}, @var{maxzen})
5323 Draws 3D functions defined in spherical coordinates.
5327 @code{spherical(@var{radius}, @var{azi}, @var{minazi}, @var{maxazi}, @var{zen},
5328 @var{minzen}, @var{maxzen})} plots the function @code{@var{radius}(@var{azi},
5329 @var{zen})} defined in spherical coordinates, with @i{azimuth} @var{azi} taking
5330 values from @var{minazi} to @var{maxazi} and @i{zenith} @var{zen} taking values
5331 from @var{minzen} to @var{maxzen}.
5333 This object is affected by the following @i{graphic options}: @mrefcomma{xu_grid}
5334 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d} and @code{color}.
5339 (%i1) draw3d(spherical(1,a,0,2*%pi,z,0,%pi))$
5341 @figure{draw_spherical}
5343 @opencatbox{Categories:}
5344 @category{Package draw}
5351 @deffn {Graphic object} triangle (@var{point_1}, @var{point_2}, @var{point_3})
5356 @code{triangle ([@var{x1},@var{y1}], [@var{x2},@var{y2}], [@var{x3},@var{y3}])} draws a triangle with vertices @code{[@var{x1},@var{y1}]}, @code{[@var{x2},@var{y2}]},
5357 and @code{[@var{x3},@var{y3}]}.
5359 This object is affected by the following @i{graphic options}:@*
5360 @mrefcomma{transparent} @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width}
5361 @mrefcomma{key} @mrefcomma{xaxis_secondary} @mrefcomma{yaxis_secondary} @mrefcomma{line_type}
5362 @mref{transform} and @code{color}.
5368 triangle([1,1],[2,2],[3,-1]))$
5370 @figure{draw_triangle}
5374 @code{triangle ([@var{x1},@var{y1},@var{z1}], [@var{x2},@var{y2},@var{z2}], [@var{x3},@var{y3},@var{z3}])} draws a triangle with vertices @code{[@var{x1},@var{y1},@var{z1}]},
5375 @code{[@var{x2},@var{y2},@var{z2}]}, and @code{[@var{x3},@var{y3},@var{z3}]}.
5377 This object is affected by the following @i{graphic options}: @mrefcomma{line_type}
5378 @mrefcomma{line_width} @mrefcomma{color} @mrefcomma{key} @mref{enhanced3d} and @mrefdot{transform}
5380 @opencatbox{Categories:}
5381 @category{Package draw}
5388 @deffn {Graphic object} tube (@var{xfun},@var{yfun},@var{zfun},@var{rfun},@var{p},@var{pmin},@var{pmax})
5389 Draws a tube in 3D with varying diameter.
5393 @code{[@var{xfun},@var{yfun},@var{zfun}]}
5394 is the parametric curve with parameter @var{p} taking values from @var{pmin}
5395 to @var{pmax}. Circles of radius @var{rfun} are placed with their centers on
5396 the parametric curve and perpendicular to it.
5398 This object is affected by the following @i{graphic options}: @mrefcomma{xu_grid}
5399 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{wired_surface} @mrefcomma{enhanced3d}
5400 @mref{color} and @mrefdot{capping}
5408 tube(cos(a), a, 0, cos(a/10)^2,
5413 @opencatbox{Categories:}
5414 @category{Package draw}
5422 @deffn {Graphic object} vector @
5423 @fname{vector} ([@var{x},@var{y}], [@var{dx},@var{dy}]) @
5424 @fname{vector} ([@var{x},@var{y},@var{z}], [@var{dx},@var{dy},@var{dz}])
5426 Draws vectors in 2D and 3D.
5428 This object is affected by the following @i{graphic options}: @mrefcomma{head_both}
5429 @mrefcomma{head_length} @mrefcomma{head_angle} @mrefcomma{head_type} @mrefcomma{line_width}
5430 @mrefcomma{line_type} @mref{key} and @code{color}.
5434 @code{vector([@var{x},@var{y}], [@var{dx},@var{dy}])} plots vector
5435 @code{[@var{dx},@var{dy}]} with origin in @code{[@var{x},@var{y}]}.
5440 (%i1) draw2d(xrange = [0,12],
5443 vector([0,1],[5,5]), /* default type */
5445 vector([3,1],[5,5]),
5447 head_type = 'nofilled,
5449 vector([6,1],[5,5]))$
5451 @figure{draw_vector}
5455 @code{vector([@var{x},@var{y},@var{z}], [@var{dx},@var{dy},@var{dz}])}
5456 plots vector @code{[@var{dx},@var{dy},@var{dz}]} with
5457 origin in @code{[@var{x},@var{y},@var{z}]}.
5462 (%i1) draw3d(color = cyan,
5463 vector([0,0,0],[1,1,1]/sqrt(3)),
5464 vector([0,0,0],[1,-1,0]/sqrt(2)),
5465 vector([0,0,0],[1,1,-2]/sqrt(6)) )$
5467 @figure{draw_vector2}
5469 @opencatbox{Categories:}
5470 @category{Package draw}
5475 @anchor{draw_renderer}
5476 @defvr {Variable} draw_renderer
5477 @c gnuplot_pipes is the default value here, it might also be gnuplot?
5478 Default value: @code{gnuplot_pipes}
5480 When @code{draw_renderer} is set to @code{'vtk}, the VTK interface is used for draw.
5482 @opencatbox{Categories:}
5483 @category{Package draw}
5491 @node Functions and Variables for pictures, Functions and Variables for worldmap, Functions and Variables for draw, Package draw
5492 @section Functions and Variables for pictures
5497 @deffn {Function} get_pixel (@var{pic},@var{x},@var{y})
5498 Returns pixel from picture. Coordinates @var{x} and @var{y} range from 0 to
5499 @code{width-1} and @code{height-1}, respectively.
5501 @opencatbox{Categories:}
5502 @category{Package draw}
5510 @anchor{make_level_picture}
5511 @deffn {Function} make_level_picture @
5512 @fname{make_level_picture} (@var{data}) @
5513 @fname{make_level_picture} (@var{data},@var{width},@var{height})
5515 Returns a levels @var{picture} object. @code{make_level_picture (@var{data})}
5516 builds the @var{picture} object from matrix @var{data}.
5517 @code{make_level_picture (@var{data},@var{width},@var{height})}
5518 builds the object from a list of numbers; in this case, both the
5519 @var{width} and the @var{height} must be given.
5521 The returned @var{picture} object contains the following
5525 @item symbol @code{level}
5528 @item an integer array with pixel data ranging from 0 to 255.
5529 Argument @var{data} must contain only numbers ranged from 0 to 255;
5530 negative numbers are substituted by 0, and those which are
5531 greater than 255 are set to 255.
5536 Level picture from matrix.
5538 (%i1) make_level_picture(matrix([3,2,5],[7,-9,3000]));
5539 (%o1) picture(level, 3, 2, @{Array: #(3 2 5 7 0 255)@})
5542 Level picture from numeric list.
5544 (%i1) make_level_picture([-2,0,54,%pi],2,2);
5545 (%o1) picture(level, 2, 2, @{Array: #(0 0 54 3)@})
5548 @opencatbox{Categories:}
5549 @category{Package draw}
5557 @anchor{make_rgb_picture}
5558 @deffn {Function} make_rgb_picture (@var{redlevel},@var{greenlevel},@var{bluelevel})
5559 Returns an rgb-coloured @var{picture} object. All three arguments must
5560 be levels picture; with red, green and blue levels.
5562 The returned @var{picture} object contains the following
5566 @item symbol @code{rgb}
5569 @item an integer array of length @var{3*width*height} with pixel data ranging
5570 from 0 to 255. Each pixel is represented by three consecutive numbers
5577 (%i1) red: make_level_picture(matrix([3,2],[7,260]));
5578 (%o1) picture(level, 2, 2, @{Array: #(3 2 7 255)@})
5579 (%i2) green: make_level_picture(matrix([54,23],[73,-9]));
5580 (%o2) picture(level, 2, 2, @{Array: #(54 23 73 0)@})
5581 (%i3) blue: make_level_picture(matrix([123,82],[45,32.5698]));
5582 (%o3) picture(level, 2, 2, @{Array: #(123 82 45 33)@})
5583 (%i4) make_rgb_picture(red,green,blue);
5584 (%o4) picture(rgb, 2, 2,
5585 @{Array: #(3 54 123 2 23 82 7 73 45 255 0 33)@})
5588 @opencatbox{Categories:}
5589 @category{Package draw}
5598 @anchor{negative_picture}
5599 @deffn {Function} negative_picture (@var{pic})
5600 Returns the negative of a (@var{level} or @var{rgb}) picture.
5602 @opencatbox{Categories:}
5603 @category{Package draw}
5611 @anchor{picture_equalp}
5612 @deffn {Function} picture_equalp (@var{x},@var{y})
5613 Returns @code{true} in case of equal pictures, and @code{false} otherwise.
5615 @opencatbox{Categories:}
5616 @category{Package draw}
5617 @category{Predicate functions}
5626 @deffn {Function} picturep (@var{x})
5627 Returns @code{true} if the argument is a well formed image,
5628 and @code{false} otherwise.
5630 @opencatbox{Categories:}
5631 @category{Package draw}
5632 @category{Predicate functions}
5640 @deffn {Function} read_xpm (@var{xpm_file})
5641 Reads a file in xpm and returns a picture object.
5643 @opencatbox{Categories:}
5644 @category{Package draw}
5653 @deffn {Function} rgb2level (@var{pic})
5654 Transforms an @var{rgb} picture into a @var{level} one by
5655 averaging the red, green and blue channels.
5657 @opencatbox{Categories:}
5658 @category{Package draw}
5666 @anchor{take_channel}
5667 @deffn {Function} take_channel (@var{im},@var{color})
5668 If argument @var{color} is @code{red}, @code{green} or @code{blue},
5669 function @code{take_channel} returns the corresponding color channel of
5674 (%i1) red: make_level_picture(matrix([3,2],[7,260]));
5675 (%o1) picture(level, 2, 2, @{Array: #(3 2 7 255)@})
5676 (%i2) green: make_level_picture(matrix([54,23],[73,-9]));
5677 (%o2) picture(level, 2, 2, @{Array: #(54 23 73 0)@})
5678 (%i3) blue: make_level_picture(matrix([123,82],[45,32.5698]));
5679 (%o3) picture(level, 2, 2, @{Array: #(123 82 45 33)@})
5680 (%i4) make_rgb_picture(red,green,blue);
5681 (%o4) picture(rgb, 2, 2,
5682 @{Array: #(3 54 123 2 23 82 7 73 45 255 0 33)@})
5683 (%i5) take_channel(%,'green); /* simple quote!!! */
5684 (%o5) picture(level, 2, 2, @{Array: #(54 23 73 0)@})
5687 @opencatbox{Categories:}
5688 @category{Package draw}
5693 @node Functions and Variables for worldmap, , Functions and Variables for pictures, Package draw
5694 @section Functions and Variables for worldmap
5696 @subsection Variables and Functions
5698 @anchor{boundaries_array}
5699 @defvr {Global variable} boundaries_array
5700 Default value: @code{false}
5702 @code{boundaries_array} is where the graphic object @code{geomap} looks
5703 for boundaries coordinates.
5705 Each component of @code{boundaries_array} is an array of floating
5706 point quantities, the coordinates of a polygonal segment or map boundary.
5708 See also @mrefdot{geomap}
5710 @opencatbox{Categories:}
5711 @category{Package draw}
5720 @anchor{numbered_boundaries}
5721 @deffn {Function} numbered_boundaries (@var{nlist})
5722 Draws a list of polygonal segments (boundaries), labeled by
5723 its numbers (@code{boundaries_array} coordinates). This is of great
5724 help when building new geographical entities.
5728 Map of Europe labeling borders with their component number in
5729 @code{boundaries_array}.
5731 (%i1) load("worldmap")$
5732 (%i2) european_borders:
5733 region_boundaries(-31.81,74.92,49.84,32.06)$
5734 (%i3) numbered_boundaries(european_borders)$
5737 @opencatbox{Categories:}
5738 @category{Package draw}
5746 @anchor{make_poly_continent}
5747 @deffn {Function} make_poly_continent @
5748 @fname{make_poly_continent} (@var{continent_name}) @
5749 @fname{make_poly_continent} (@var{country_list})
5751 Makes the necessary polygons to draw a colored continent
5752 or a list of countries.
5757 (%i1) load("worldmap")$
5758 (%i2) /* A continent */
5759 make_poly_continent(Africa)$
5760 (%i3) apply(draw2d, %)$
5762 @figure{worldmap_make_poly_continent}
5764 (%i4) /* A list of countries */
5765 make_poly_continent([Germany,Denmark,Poland])$
5766 (%i5) apply(draw2d, %)$
5768 @figure{worldmap_make_poly_continent2}
5770 @opencatbox{Categories:}
5771 @category{Package draw}
5780 @anchor{make_poly_country}
5781 @deffn {Function} make_poly_country (@var{country_name})
5782 Makes the necessary polygons to draw a colored country.
5783 If islands exist, one country can be defined with more than
5789 (%i1) load("worldmap")$
5790 (%i2) make_poly_country(India)$
5791 (%i3) apply(draw2d, %)$
5793 @figure{worldmap_make_poly_country}
5795 @opencatbox{Categories:}
5796 @category{Package draw}
5805 @anchor{make_polygon}
5806 @deffn {Function} make_polygon (@var{nlist})
5807 Returns a @code{polygon} object from boundary indices. Argument
5808 @var{nlist} is a list of components of @code{boundaries_array}.
5812 Bhutan is defined by boundary numbers 171, 173
5813 and 1143, so that @code{make_polygon([171,173,1143])}
5814 appends arrays of coordinates @code{boundaries_array[171]},
5815 @code{boundaries_array[173]} and @code{boundaries_array[1143]} and
5816 returns a @code{polygon} object suited to be plotted by
5817 @code{draw}. To avoid an error message, arrays must be
5818 compatible in the sense that any two consecutive
5819 arrays have two coordinates in the extremes in common. In this
5820 example, the two first components of @code{boundaries_array[171]} are
5821 equal to the last two coordinates of @code{boundaries_array[173]}, and
5822 the two first of @code{boundaries_array[173]} are equal to the two first
5823 of @code{boundaries_array[1143]}; in conclusion, boundary numbers
5824 171, 173 and 1143 (in this order) are compatible and the colored
5825 polygon can be drawn.
5827 (%i1) load("worldmap")$
5829 (%o2) [[171, 173, 1143]]
5830 (%i3) boundaries_array[171];
5832 #(88.750549 27.14727 88.806351 27.25305 88.901367 27.282221
5833 88.917877 27.321039)@}
5834 (%i4) boundaries_array[173];
5836 #(91.659554 27.76511 91.6008 27.66666 91.598022 27.62499
5837 91.631348 27.536381 91.765533 27.45694 91.775253 27.4161
5838 92.007751 27.471939 92.11441 27.28583 92.015259 27.168051
5839 92.015533 27.08083 92.083313 27.02277 92.112183 26.920271
5840 92.069977 26.86194 91.997192 26.85194 91.915253 26.893881
5841 91.916924 26.85416 91.8358 26.863331 91.712479 26.799999
5842 91.542191 26.80444 91.492188 26.87472 91.418854 26.873329
5843 91.371353 26.800831 91.307457 26.778049 90.682457 26.77417
5844 90.392197 26.903601 90.344131 26.894159 90.143044 26.75333
5845 89.98996 26.73583 89.841919 26.70138 89.618301 26.72694
5846 89.636093 26.771111 89.360786 26.859989 89.22081 26.81472
5847 89.110237 26.829161 88.921631 26.98777 88.873016 26.95499
5848 88.867737 27.080549 88.843307 27.108601 88.750549
5850 (%i5) boundaries_array[1143];
5852 #(91.659554 27.76511 91.666924 27.88888 91.65831 27.94805
5853 91.338028 28.05249 91.314972 28.096661 91.108856 27.971109
5854 91.015808 27.97777 90.896927 28.05055 90.382462 28.07972
5855 90.396088 28.23555 90.366074 28.257771 89.996353 28.32333
5856 89.83165 28.24888 89.58609 28.139999 89.35997 27.87166
5857 89.225517 27.795 89.125793 27.56749 88.971077 27.47361
5858 88.917877 27.321039)@}
5859 (%i6) Bhutan_polygon: make_polygon([171,173,1143])$
5860 (%i7) draw2d(Bhutan_polygon)$
5862 @figure{worldmap_make_polygon}
5864 @opencatbox{Categories:}
5865 @category{Package draw}
5874 @anchor{region_boundaries}
5875 @deffn {Function} region_boundaries (@var{x1},@var{y1},@var{x2},@var{y2})
5876 Detects polygonal segments of global variable @code{boundaries_array}
5877 fully contained in the rectangle with vertices (@var{x1},@var{y1}) -upper left-
5878 and (@var{x2},@var{y2}) -bottom right-.
5882 Returns segment numbers for plotting southern Italy.
5884 (%i1) load("worldmap")$
5885 (%i2) region_boundaries(10.4,41.5,20.7,35.4);
5886 (%o2) [1846, 1863, 1864, 1881, 1888, 1894]
5887 (%i3) draw2d(geomap(%))$
5889 @figure{worldmap_region_boundaries}
5891 @opencatbox{Categories:}
5892 @category{Package draw}
5899 @anchor{region_boundaries_plus}
5900 @deffn {Function} region_boundaries_plus (@var{x1},@var{y1},@var{x2},@var{y2})
5901 Detects polygonal segments of global variable @code{boundaries_array}
5902 containing at least one vertex in the rectangle defined by vertices (@var{x1},@var{y1})
5903 -upper left- and (@var{x2},@var{y2}) -bottom right-.
5908 (%i1) load("worldmap")$
5909 (%i2) region_boundaries_plus(10.4,41.5,20.7,35.4);
5910 (%o2) [1060, 1062, 1076, 1835, 1839, 1844, 1846, 1858,
5911 1861, 1863, 1864, 1871, 1881, 1888, 1894, 1897]
5912 (%i3) draw2d(geomap(%))$
5914 @figure{worldmap_region_boundaries_plus}
5916 @opencatbox{Categories:}
5917 @category{Package draw}
5925 @subsection Graphic objects
5929 @deffn {Graphic object} geomap @
5930 @fname{geomap} (@var{numlist}) @
5931 @fname{geomap} (@var{numlist},@var{3Dprojection})
5933 Draws cartographic maps in 2D and 3D.
5937 This function works together with global variable @code{boundaries_array}.
5939 Argument @var{numlist} is a list containing numbers or lists of numbers.
5940 All these numbers must be integers greater or equal than zero,
5941 representing the components of global array @code{boundaries_array}.
5943 Each component of @code{boundaries_array} is an array of floating
5944 point quantities, the coordinates of a polygonal segment or map boundary.
5946 @code{geomap (@var{numlist})} flattens its arguments and draws the
5947 associated boundaries in @code{boundaries_array}.
5949 This object is affected by the following @i{graphic options}: @mrefcomma{line_width}
5950 @mref{line_type} and @code{color}.
5954 A simple map defined by hand:
5956 (%i1) load("worldmap")$
5957 (%i2) /* Vertices of boundary #0: @{(1,1),(2,5),(4,3)@} */
5958 ( bnd0: make_array(flonum,6),
5959 bnd0[0]:1.0, bnd0[1]:1.0, bnd0[2]:2.0,
5960 bnd0[3]:5.0, bnd0[4]:4.0, bnd0[5]:3.0 )$
5961 (%i3) /* Vertices of boundary #1: @{(4,3),(5,4),(6,4),(5,1)@} */
5962 ( bnd1: make_array(flonum,8),
5963 bnd1[0]:4.0, bnd1[1]:3.0, bnd1[2]:5.0, bnd1[3]:4.0,
5964 bnd1[4]:6.0, bnd1[5]:4.0, bnd1[6]:5.0, bnd1[7]:1.0)$
5965 (%i4) /* Vertices of boundary #2: @{(5,1), (3,0), (1,1)@} */
5966 ( bnd2: make_array(flonum,6),
5967 bnd2[0]:5.0, bnd2[1]:1.0, bnd2[2]:3.0,
5968 bnd2[3]:0.0, bnd2[4]:1.0, bnd2[5]:1.0 )$
5969 (%i5) /* Vertices of boundary #3: @{(1,1), (4,3)@} */
5970 ( bnd3: make_array(flonum,4),
5971 bnd3[0]:1.0, bnd3[1]:1.0, bnd3[2]:4.0, bnd3[3]:3.0)$
5972 (%i6) /* Vertices of boundary #4: @{(4,3), (5,1)@} */
5973 ( bnd4: make_array(flonum,4),
5974 bnd4[0]:4.0, bnd4[1]:3.0, bnd4[2]:5.0, bnd4[3]:1.0)$
5975 (%i7) /* Pack all together in boundaries_array */
5976 ( boundaries_array: make_array(any,5),
5977 boundaries_array[0]: bnd0, boundaries_array[1]: bnd1,
5978 boundaries_array[2]: bnd2, boundaries_array[3]: bnd3,
5979 boundaries_array[4]: bnd4 )$
5980 (%i8) draw2d(geomap([0,1,2,3,4]))$
5982 @figure{worldmap_geomap}
5984 The auxiliary package @code{worldmap} sets the global variable
5985 @code{boundaries_array} to real world boundaries in
5986 (longitude, latitude) coordinates. These data are in the
5987 public domain and come from
5988 @c Link is dead, linked to archive.org. Does someone know a better Link?
5989 @url{https://web.archive.org/web/20100310124019/http://www-cger.nies.go.jp/grid-e/gridtxt/grid19.html}.
5990 Package @code{worldmap} defines also boundaries for countries,
5991 continents and coastlines as lists with the necessary components of
5992 @code{boundaries_array} (see file @code{share/draw/worldmap.mac}
5993 for more information). Package @code{worldmap} automatically loads
5994 package @code{worldmap}.
5996 (%i1) load("worldmap")$
5997 (%i2) c1: gr2d(geomap([Canada,United_States,
5999 (%i3) c2: gr2d(geomap(Africa))$
6000 (%i4) c3: gr2d(geomap([Oceania,China,Japan]))$
6001 (%i5) c4: gr2d(geomap([France,Portugal,Spain,
6002 Morocco,Western_Sahara]))$
6003 (%i6) draw(columns = 2,
6006 @figure{worldmap_geomap2}
6008 Package @code{worldmap} is also useful for plotting
6009 countries as polygons. In this case, graphic object
6010 @code{geomap} is no longer necessary and the @code{polygon}
6011 object is used instead. Since lists are now used and not
6012 arrays, maps rendering will be slower. See also @mref{make_poly_country}
6013 and @mref{make_poly_continent} to understand the following code.
6015 (%i1) load("worldmap")$
6016 (%i2) mymap: append(
6017 [color = white], /* borders are white */
6018 [fill_color = red], make_poly_country(Bolivia),
6019 [fill_color = cyan], make_poly_country(Paraguay),
6020 [fill_color = green], make_poly_country(Colombia),
6021 [fill_color = blue], make_poly_country(Chile),
6022 [fill_color = "#23ab0f"], make_poly_country(Brazil),
6023 [fill_color = goldenrod], make_poly_country(Argentina),
6024 [fill_color = "midnight-blue"], make_poly_country(Uruguay))$
6025 (%i3) apply(draw2d, mymap)$
6027 @figure{worldmap_geomap3}
6032 @code{geomap (@var{numlist})} projects map boundaries on the sphere of radius 1
6033 centered at (0,0,0). It is possible to change the sphere or the projection type
6034 by using @code{geomap (@var{numlist},@var{3Dprojection})}.
6036 Available 3D projections:
6040 @code{[spherical_projection,@var{x},@var{y},@var{z},@var{r}]}: projects map boundaries on the sphere of
6041 radius @var{r} centered at (@var{x},@var{y},@var{z}).
6043 (%i1) load("worldmap")$
6044 (%i2) draw3d(geomap(Australia), /* default projection */
6046 [spherical_projection,2,2,2,3]))$
6048 @figure{worldmap_geomap4}
6051 @code{[cylindrical_projection,@var{x},@var{y},@var{z},@var{r},@var{rc}]}: re-projects spherical map boundaries on the cylinder of radius
6052 @var{rc} and axis passing through the poles of the globe of radius @var{r} centered at (@var{x},@var{y},@var{z}).
6054 (%i1) load("worldmap")$
6055 (%i2) draw3d(geomap([America_coastlines,Eurasia_coastlines],
6056 [cylindrical_projection,2,2,2,3,4]))$
6058 @figure{worldmap_geomap5}
6061 @code{[conic_projection,@var{x},@var{y},@var{z},@var{r},@var{alpha}]}: re-projects spherical map boundaries on the cones of angle @var{alpha},
6062 with axis passing through the poles of the globe of radius @var{r} centered at (@var{x},@var{y},@var{z}). Both
6063 the northern and southern cones are tangent to sphere.
6065 (%i1) load("worldmap")$
6066 (%i2) draw3d(geomap(World_coastlines,
6067 [conic_projection,0,0,0,1,90]))$
6070 @figure{worldmap_geomap6}
6072 See also @url{https://riotorto.users.sourceforge.net/Maxima/gnuplot/geomap/}
6073 for more elaborated examples.
6075 @opencatbox{Categories:}
6076 @category{Package draw}