Fix some links in the documentation.
[maxima/cygwin.git] / doc / info / draw.texi
blob3b011bbae2b039647ce3a9a45ea8f8242a5f41ab
1 @menu
2 * Introduction to draw::
3 * Functions and Variables for draw::
4 * Functions and Variables for pictures::
5 * Functions and Variables for worldmap::
6 @end menu
10 @node Introduction to draw, Functions and Variables for draw, draw-pkg, draw-pkg
11 @section Introduction to draw
14 @code{draw} is a Maxima-Gnuplot and a Maxima-vtk interface.
16 There are three main functions to be used at Maxima level: 
17 @itemize @bullet
18 @item @mrefcomma{draw2d} draws a single 2D scene.
19 @item @mrefcomma{draw3d} draws a single 3D scene.
20 @item @mrefcomma{draw} can be filled with multiple @mref{gr2d} and @mref{gr3d}
21       commands that each creates a draw scene all sharing the same window.
22 @end itemize      
23 Each scene can contain any number of objects and @code{key=value} pairs
24 with options for the scene or the following objects.
26 A selection of useful objects a scene can be made up from are:
27 @itemize @bullet
28 @item @mref{explicit} plots a function.
29 @item @mref{implicit} plots all points an equation is true at.
30 @item @mref{points} plots points that are connected by lines if the option
31       @mref{points_joined} was set to @code{true} in a previous line of the
32       current scene.
33 @item @mref{parametric} allows to specify separate expressions that calculate
34       the x, y (and in 3d plots also for the z) variable.
35 @end itemize
37 A short description of all draw commands and options including example plots
38 (in the html and pdf version of this manual) can be found in the section
39 @xref{Functions and Variables for draw}. An online version of the html manual can be
40 found at @url{http://maxima.sourceforge.net/docs/manual/maxima_singlepage.html#draw}.
41 More elaborated examples of this package can be found at the following locations:
43 @url{http://riotorto.users.sourceforge.net/Maxima/gnuplot/} @*
44 @url{http://riotorto.users.sourceforge.net/Maxima/vtk/}
46 Example:
48 @example
49 (%i1) draw2d(
50           title="Two simple plots",
51           xlabel="x",ylabel="y",grid=true,
53           color=red,key="A sinus",
54           explicit(sin(x),x,1,10),
55           color=blue,line_type=dots,key="A cosinus",
56           explicit(cos(x),x,1,10)
58 @end example
59 @figure{draw_intro}
61 You need Gnuplot 4.2 or newer to run draw; If you are using wxMaxima as a
62 front end @code{wxdraw}, @code{wxdraw2d} and @code{wxdraw3d} are drop-in
63 replacements for draw that do the same as @mrefcomma{draw} @mref{draw2d} and
64 @mref{draw3d} but embed the resulting plot in the worksheet.
66 @opencatbox
67 @category{Plotting}
68 @category{Share packages}
69 @category{Package draw}
70 @closecatbox
73 @node Functions and Variables for draw, Functions and Variables for pictures, Introduction to draw, draw-pkg
74 @section Functions and Variables for draw
79 @subsection Scenes
82 @anchor{gr2d}
83 @deffn {Scene constructor} gr2d (@var{argument_1}, ...)
85 Function @code{gr2d} builds an object describing a 2D scene. Arguments are
86 @i{graphic options}, @i{graphic objects}, or lists containing both graphic options and objects.
87 This scene is interpreted sequentially: @i{graphic options} affect those @i{graphic objects}
88 placed on its right. Some @i{graphic options} affect the global appearance of the scene.
90 This is the list of @i{graphic objects} available for scenes in two dimensions:
91 @mrefcomma{bars} @mrefcomma{ellipse} @mrefcomma{explicit} @mrefcomma{image} @mrefcomma{implicit} @mrefcomma{label}
92 @mrefcomma{parametric} @mrefcomma{points} @mrefcomma{polar} @mrefcomma{polygon} @mrefcomma{quadrilateral}
93 @mrefcomma{rectangle} @mrefcomma{triangle} @mref{vector} and @code{geomap}
94 (this one defined in package @code{worldmap}).
96 See also @mref{draw}
97 and @mrefdot{draw2d}
99 @c ===beg===
100 @c draw(
101 @c     gr2d(
102 @c         key="sin (x)",grid=[2,2],
103 @c         explicit(
104 @c             sin(x),
105 @c             x,0,2*%pi
106 @c         )
107 @c     ),
108 @c     gr2d(
109 @c         key="cos (x)",grid=[2,2],
110 @c         explicit(
111 @c             cos(x),
112 @c             x,0,2*%pi
113 @c         )
114 @c     )
115 @c  );
116 @c ===end===
117 @example
118 (%i1) draw(
119     gr2d(
120         key="sin (x)",grid=[2,2],
121         explicit(
122             sin(x),
123             x,0,2*%pi
124         )
125     ),
126     gr2d(
127         key="cos (x)",grid=[2,2],
128         explicit(
129             cos(x),
130             x,0,2*%pi
131         )
132     )
133  );
134 (%o1)           [gr2d(explicit), gr2d(explicit)]
135 @end example
136 @figure{draw_scene}
139 @opencatbox
140 @category{Package draw}
141 @closecatbox
143 @end deffn
146 @anchor{gr3d}
147 @deffn {Scene constructor} gr3d (@var{argument_1}, ...)
149 Function @code{gr3d} builds an object describing a 3d scene. Arguments are
150 @i{graphic options}, @i{graphic objects}, or lists containing both graphic options
151 and objects. This scene is interpreted sequentially: @i{graphic options} affect those 
152 @i{graphic objects} placed on its right. Some @i{graphic options} affect the global
153 appearance of the scene.
155 This is the list of @i{graphic objects} available for scenes in three
156 dimensions:@*
157 @mrefcomma{cylindrical} @mrefcomma{elevation_grid} @mrefcomma{explicit} @mrefcomma{implicit}
158 @mrefcomma{label} @mrefcomma{mesh} @mrefcomma{parametric}@*
159 @mrefcomma{parametric_surface} @mrefcomma{points} @mrefcomma{quadrilateral}
160 @mrefcomma{spherical} @mrefcomma{triangle} @mrefcomma{tube}@*
161 @mrefcomma{vector} and @mref{geomap} (this one defined in package @code{worldmap}).
163 See also @mref{draw} and @mrefdot{draw3d}
165 @opencatbox
166 @category{Package draw}
167 @closecatbox
169 @end deffn
174 @subsection Functions
178 @anchor{draw}
179 @deffn {Function} draw (<arg_1>, ...)
181 Plots a series of scenes; its arguments are @code{gr2d} and/or @code{gr3d} 
182 objects, together with some options, or lists of scenes and options.
183 By default, the scenes are put together
184 in one column.
186 Besides scenes the function @code{draw} accepts the following global options:
187 @mrefcomma{terminal} @mrefcomma{columns} @mrefcomma{dimensions} @mref{file_name}
188 and @mrefdot{delay}
190 Functions @mref{draw2d} and @mref{draw3d} short cuts that can be used 
191 when only one scene is required, in two or three dimensions, respectively.
193 See also @mref{gr2d} and @mrefdot{gr3d}
195 Examples:
197 @example
198 (%i1) scene1: gr2d(title="Ellipse",
199                    nticks=300,
200                    parametric(2*cos(t),5*sin(t),t,0,2*%pi))$
201 (%i2) scene2: gr2d(title="Triangle",
202                    polygon([4,5,7],[6,4,2]))$
203 (%i3) draw(scene1, scene2, columns = 2)$
204 @end example
205 @figure{draw_intro2}
207 @example
208 (%i1) scene1: gr2d(title="A sinus",
209         grid=true,
210         explicit(sin(t),t,0,2*%pi))$
211 (%i2) scene2: gr2d(title="A cosinus",
212         grid=true,
213         explicit(cos(t),t,0,2*%pi))$
214 (%i3) draw(scene1, scene2)$
215 @end example
216 @figure{draw_intro3}
218 The following two draw sentences are equivalent:
219 @example
220 (%i1) draw(gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1)));
221 (%o1)                          [gr3d(explicit)]
222 (%i2) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1));
223 (%o2)                          [gr3d(explicit)]
224 @end example
226 Creating an animated gif file:
227 @example
228 (%i1) draw(
229         delay     = 100,
230         file_name = "zzz",
231         terminal  = 'animated_gif,
232         gr2d(explicit(x^2,x,-1,1)),
233         gr2d(explicit(x^3,x,-1,1)),
234         gr2d(explicit(x^4,x,-1,1)));
235 End of animation sequence
236 (%o1)          [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
237 @end example
238 @figure{draw_equiv}
239 See also @mrefcomma{gr2d} @mrefcomma{gr3d} @mref{draw2d} and @mrefdot{draw3d}
241 @opencatbox
242 @category{Package draw}
243 @category{File output}
244 @closecatbox
245 @end deffn
251 @anchor{draw2d}
252 @deffn {Function} draw2d (@var{argument_1}, ...)
254 This function is a shortcut for
255 @code{draw(gr2d(@var{options}, ..., @var{graphic_object}, ...))}.
257 It can be used to plot an unique scene in 2d, as can be seen in most examples below.
259 See also @mref{draw} and @mrefdot{gr2d}
261 @opencatbox
262 @category{Package draw}
263 @category{File output}
264 @closecatbox
265 @end deffn
272 @anchor{draw3d}
273 @deffn {Function} draw3d (@var{argument_1}, ...)
275 This function is a shortcut for
276 @code{draw(gr3d(@var{options}, ..., @var{graphic_object}, ...))}.
278 It can be used to plot an unique scene in 3d, as can be seen in many examples below.
280 See also @mref{draw} and @mrefdot{gr3d}
282 @opencatbox
283 @category{Package draw}
284 @category{File output}
285 @closecatbox
286 @end deffn
290 @anchor{draw_file}
291 @deffn {Function} draw_file (@var{graphic option}, ..., @var{graphic object}, ...)
293 Saves the current plot into a file. Accepted graphics options are:
294 @code{terminal}, @code{dimensions} and @code{file_name}. 
296 Example:
298 @example
299 (%i1) /* screen plot */
300       draw(gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1)))$
301 (%i2) /* same plot in eps format */
302       draw_file(terminal  = eps,
303                 dimensions = [5,5]) $
304 @end example
306 @opencatbox
307 @category{Package draw}
308 @category{File output}
309 @closecatbox
310 @end deffn
314 @anchor{multiplot_mode}
315 @deffn {Function} multiplot_mode (@var{term})
317 This function enables Maxima to work in one-window multiplot mode with terminal
318 @var{term}; accepted arguments for this function are @code{screen}, 
319 @code{wxt}, @code{aquaterm}, @code{windows} and @code{none}.
321 When multiplot mode is enabled, each call to @code{draw} sends a new plot to the
322 same window, without erasing the previous ones. To disable the multiplot mode,
323 write @code{multiplot_mode(none)}.
325 When multiplot mode is enabled, global option @code{terminal} is blocked and you
326 have to disable this working mode before changing to another terminal.
328 On Windows this feature requires Gnuplot 5.0 or newer.
329 Note, that just plotting multiple expressions into the same plot doesn't require
330 multiplot: It can be done by just issuing multiple @mref{explicit} or similar
331 commands in a row.
333 Example:
335 @example
336 (%i1) set_draw_defaults(
337          xrange = [-1,1],
338          yrange = [-1,1],
339          grid   = true,
340          title  = "Step by step plot" )$
341 (%i2) multiplot_mode(screen)$
342 (%i3) draw2d(color=blue,  explicit(x^2,x,-1,1))$
343 (%i4) draw2d(color=red,   explicit(x^3,x,-1,1))$
344 (%i5) draw2d(color=brown, explicit(x^4,x,-1,1))$
345 (%i6) multiplot_mode(none)$
346 @end example
347 @figure{draw_multiplot}
349 @opencatbox
350 @category{Package draw}
351 @category{File output}
352 @closecatbox
353 @end deffn
359 @anchor{set_draw_defaults}
360 @deffn {Function} set_draw_defaults (@var{graphic option}, ..., @var{graphic object}, ...)
362 Sets user graphics options. This function is useful for plotting a sequence
363 of graphics with common graphics options. Calling this function without
364 arguments removes user defaults.
366 Example:
368 @example
369 (%i1) set_draw_defaults(
370          xrange = [-10,10],
371          yrange = [-2, 2],
372          color  = blue,
373          grid   = true)$
374 (%i2) /* plot with user defaults */
375       draw2d(explicit(((1+x)**2/(1+x*x))-1,x,-10,10))$
376 (%i3) set_draw_defaults()$
377 (%i4) /* plot with standard defaults */
378       draw2d(explicit(((1+x)**2/(1+x*x))-1,x,-10,10))$
379 @end example
381 @opencatbox
382 @category{Package draw}
383 @closecatbox
385 @end deffn
390 @subsection Graphics options
393 @anchor{adapt_depth_draw}
394 @defvr {Graphic option} adapt_depth
395 Default value: 10
397 @code{adapt_depth} is the maximum number of splittings used by the adaptive plotting routine.
399 This option is relevant only for 2d @code{explicit} functions.
401 See also @code{nticks}
403 @opencatbox
404 @category{Package draw}
405 @closecatbox
407 @end defvr
410 @anchor{allocation}
411 @defvr {Graphic option} allocation
412 Default value: @code{false}
414 With option @code{allocation} it is possible to place a scene in the
415 output window at will; this is of interest in multiplots. When @code{false},
416 the scene is placed automatically, depending on the value assigned to option
417 @code{columns}. In any other case, @code{allocation} must be set to a list of
418 two pairs of numbers; the first corresponds to the position of the lower left
419 corner of the scene, and the second pair gives the width and height of the plot.
420 All quantities must be given in relative coordinates, between 0 and 1.
422 Examples:
424 In site graphics.
426 @example
427 (%i1) draw(
428         gr2d(
429           explicit(x^2,x,-1,1)),
430         gr2d(
431           allocation = [[1/4, 1/4],[1/2, 1/2]],
432           explicit(x^3,x,-1,1),
433           grid = true) ) $
434 @end example
435 @figure{draw_allocation}
437 Multiplot with selected dimensions.
439 @example
440 (%i1) draw(
441         terminal = wxt,
442         gr2d(
443           grid=[5,5],
444           allocation = [[0, 0],[1, 1/4]],
445           explicit(x^2,x,-1,1)),
446         gr3d(
447           allocation = [[0, 1/4],[1, 3/4]],
448           explicit(x^2+y^2,x,-1,1,y,-1,1) ))$
449 @end example
450 @figure{draw_allocation2}
452 See also option @mrefdot{columns}
454 @opencatbox
455 @category{Package draw}
456 @closecatbox
458 @end defvr
461 @anchor{axis_3d}
462 @defvr {Graphic option} axis_3d
463 Default value: @code{true}
465 If @code{axis_3d} is @code{true}, the @var{x}, @var{y} and @var{z} axis are shown in 3d scenes.
467 Since this is a global graphics option, its position in the scene description
468 does not matter.
470 Example:
472 @example
473 (%i1) draw3d(axis_3d = false,
474              explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
475 @end example
476 @figure{draw_axis3d}
478 See also @mrefcomma{axis_bottom}  @mrefcomma{axis_left} @mrefcomma{axis_top} and @mref{axis_right} for axis in 2d.
480 @opencatbox
481 @category{Package draw}
482 @closecatbox
484 @end defvr
488 @anchor{axis_bottom}
489 @defvr {Graphic option} axis_bottom
490 Default value: @code{true}
492 If @code{axis_bottom} is @code{true}, the bottom axis is shown in 2d scenes.
494 Since this is a global graphics option, its position in the scene description
495 does not matter.
497 Example:
499 @example
500 (%i1) draw2d(axis_bottom = false,
501              explicit(x^3,x,-1,1))$
502 @end example
503 @figure{draw_axis_bottom}
505 See also @mrefcomma{axis_left}  @mrefcomma{axis_top} @mref{axis_right} and @mrefdot{axis_3d}
507 @opencatbox
508 @category{Package draw}
509 @closecatbox
511 @end defvr
515 @anchor{axis_left}
516 @defvr {Graphic option} axis_left
517 Default value: @code{true}
519 If @code{axis_left} is @code{true}, the left axis is shown in 2d scenes.
521 Since this is a global graphics option, its position in the scene description
522 does not matter.
524 Example:
526 @example
527 (%i1) draw2d(axis_left = false,
528              explicit(x^3,x,-1,1))$
529 @end example
531 See also @mrefcomma{axis_bottom}  @mrefcomma{axis_top} @mref{axis_right} and @mrefdot{axis_3d}
533 @opencatbox
534 @category{Package draw}
535 @closecatbox
537 @end defvr
541 @anchor{axis_right}
542 @defvr {Graphic option} axis_right
543 Default value: @code{true}
545 If @code{axis_right} is @code{true}, the right axis is shown in 2d scenes.
547 Since this is a global graphics option, its position in the scene description
548 does not matter.
550 Example:
552 @example
553 (%i1) draw2d(axis_right = false,
554              explicit(x^3,x,-1,1))$
555 @end example
557 See also @mrefcomma{axis_bottom}  @mrefcomma{axis_left} @mref{axis_top} and @mrefdot{axis_3d}
559 @opencatbox
560 @category{Package draw}
561 @closecatbox
563 @end defvr
567 @anchor{axis_top}
568 @defvr {Graphic option} axis_top
569 Default value: @code{true}
571 If @code{axis_top} is @code{true}, the top axis is shown in 2d scenes.
573 Since this is a global graphics option, its position in the scene description
574 does not matter.
576 Example:
578 @example
579 (%i1) draw2d(axis_top = false,
580              explicit(x^3,x,-1,1))$
581 @end example
583 See also @mrefcomma{axis_bottom}   @mrefcomma{axis_left}  @mrefcomma{axis_right}  and @mrefdot{axis_3d}
585 @opencatbox
586 @category{Package draw}
587 @closecatbox
589 @end defvr
593 @anchor{background_color}
594 @defvr {Graphic option} background_color
595 Default value: @code{white}
597 Sets the background color for terminals. Default background color is white.
599 Since this is a global graphics option, its position in the scene description
600 does not matter.
602 This option das not work with terminals @code{epslatex} and @code{epslatex_standalone}.
604 See also @code{color}
606 @opencatbox
607 @category{Package draw}
608 @closecatbox
610 @end defvr
614 @anchor{border}
615 @defvr {Graphic option} border
616 Default value: @code{true}
618 If @code{border} is @code{true}, borders of polygons are painted
619 according to @code{line_type} and @code{line_width}.
621 This option affects the following graphic objects:
622 @itemize @bullet
624 @item
625 @code{gr2d}: @mrefcomma{polygon} @mref{rectangle} and @mrefdot{ellipse}
626 @end itemize
628 Example:
630 @example
631 (%i1) draw2d(color       = brown,
632              line_width  = 8,
633              polygon([[3,2],[7,2],[5,5]]),
634              border      = false,
635              fill_color  = blue,
636              polygon([[5,2],[9,2],[7,5]]) )$
637 @end example
638 @figure{draw_border}
640 @opencatbox
641 @category{Package draw}
642 @closecatbox
644 @end defvr
648 @anchor{capping}
649 @defvr {Graphic option} capping
650 Default value: @code{[false, false]}
652 A list with two possible elements, @code{true} and @code{false},
653 indicating whether the extremes of a graphic object @code{tube} remain closed
654 or open. By default, both extremes are left open.
656 Setting @code{capping = false} is equivalent to @code{capping = [false, false]},
657 and @code{capping = true} is equivalent to @code{capping = [true, true]}.
659 Example:
661 @example
662 (%i1) draw3d(
663         capping = [false, true],
664         tube(0, 0, a, 1,
665              a, 0, 8) )$
666 @end example
667 @figure{draw_tube_extremes}
669 @opencatbox
670 @category{Package draw}
671 @closecatbox
673 @end defvr
677 @anchor{cbrange}
678 @defvr {Graphic option} cbrange
679 Default value: @code{auto}
681 If @code{cbrange} is @code{auto}, the range for the values which are
682 colored when @code{enhanced3d} is not @code{false} is computed
683 automatically. Values outside of the color range use color of the
684 nearest extreme.
686 When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{cbrange} has
687 no effect.
689 If the user wants a specific interval for the colored values, it must
690 be given as a Maxima list, as in @code{cbrange=[-2, 3]}.
692 Since this is a global graphics option, its position in the scene description
693 does not matter.
695 Example:
697 @example
698 (%i1) draw3d (
699         enhanced3d     = true,
700         color          = green,
701         cbrange = [-3,10],
702         explicit(x^2+y^2, x,-2,2,y,-2,2)) $
703 @end example
704 @figure{draw_cbrange}
706 See also @mrefcomma{enhanced3d}  @mref{colorbox} and @mrefdot{cbtics}
708 @opencatbox
709 @category{Package draw}
710 @closecatbox
711 @end defvr
715 @anchor{cbtics}
716 @defvr {Graphic option} cbtics
717 Default value: @code{auto}
719 This graphic option controls the way tic marks are drawn on the colorbox
720 when option @code{enhanced3d} is not @code{false}.
722 When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{cbtics} has
723 no effect.
725 See @code{xtics} for a complete description.
727 Example :
729 @example
730 (%i1) draw3d (
731         enhanced3d = true,
732         color      = green,
733         cbtics  = @{["High",10],["Medium",05],["Low",0]@},
734         cbrange = [0, 10],
735         explicit(x^2+y^2, x,-2,2,y,-2,2)) $
736 @end example
737 @figure{draw_cbtics}
739 See also @mrefcomma{enhanced3d}  @mref{colorbox} and @mrefdot{cbrange}
741 @opencatbox
742 @category{Package draw}
743 @closecatbox
745 @end defvr
747 @anchor{color_draw}
748 @defvr {Graphic option} color
749 Default value: @code{blue}
751 @code{color} specifies the color for plotting lines, points, borders of
752 polygons and labels.
754 Colors can be given as names or in hexadecimal @i{rgb} code. If a gnuplot
755 version >= 5.0 is used and the terminal that is in use supports this
756 @i{rgba} colors with transparency information are also supported.
758 Available color names are:
759 @verbatim
760 white            black            gray0            grey0 
761 gray10           grey10           gray20           grey20     
762 gray30           grey30           gray40           grey40     
763 gray50           grey50           gray60           grey60     
764 gray70           grey70           gray80           grey80
765 gray90           grey90           gray100          grey100 
766 gray             grey             light_gray       light_grey 
767 dark_gray        dark_grey        red              light_red 
768 dark_red         yellow           light_yellow     dark_yellow
769 green            light_green      dark_green       spring_green
770 forest_green     sea_green        blue             light_blue 
771 dark_blue        midnight_blue    navy             medium_blue 
772 royalblue        skyblue          cyan             light_cyan 
773 dark_cyan        magenta          light_magenta    dark_magenta
774 turquoise        light_turquoise  dark_turquoise   pink 
775 light_pink       dark_pink        coral            light_coral 
776 orange_red       salmon           light_salmon     dark_salmon 
777 aquamarine       khaki            dark_khaki       goldenrod 
778 light_goldenrod  dark_goldenrod   gold             beige 
779 brown            orange           dark_orange      violet 
780 dark_violet      plum             purple
781 @end verbatim
783 Cromatic componentes in hexadecimal code are introduced in the form @code{"#rrggbb"}.
785 Example:
787 @example
788 (%i1) draw2d(explicit(x^2,x,-1,1), /* default is black */
789              color = red,
790              explicit(0.5 + x^2,x,-1,1),
791              color = blue,
792              explicit(1 + x^2,x,-1,1),
793              color = light_blue,
794              explicit(1.5 + x^2,x,-1,1),
795              color = "#23ab0f",
796              label(["This is a label",0,1.2])  )$
797 @end example
798 @figure{draw_color}
799 @example
800 (%i1) draw2d(
801              line_width=50,
802              color="#FF0000",
803              explicit(sin(x),x,0,10),
804              color="#0000FF80",
805              explicit(cos(x),x,0,10)
806       );
807 @end example
808 @figure{draw_color2}
810 @example
811 (%i1) H(p,p_0) := %i/(2*%pi*(p-p_0))$
812 (%i2) draw2d(
813        proportional_axes=xy,
814        ip_grid=[150,150],
815        grid=true,
816        makelist(
817          [
818            color=printf(false,"#~2,'0x~2,'0x~2,'0x",i*10,0,0),
819            key_pos=top_left,
820            key = if mod(i,5)=0 then sconcat("H=",i,"A/M") else "",
821            implicit(
822              cabs(H(x+%i*y,-1-%i)+H(x+%i*y,1+%i)-H(x+%i*y,1-%i)
823                   -H(x+%i*y,-1+%i))=i/10,
824              x,-3,3,
825              y,-3,3
826            )
827          ],
828          i,1,25
829        )
830       )$
831 @end example
832 @figure{draw_color3}
834 @example
835 (%i1) draw2d(
836         "figures/draw_color4",
837         makelist(
838             [
839                 color=i,
840                 key=sconcat("color =",i),
841                 explicit(sin(i*x),x,0,1)
842             ],
843             i,0,17
844         )
845     )$
846 @end example
847 @figure{draw_color4}
850 See also @mrefdot{fill_color}
852 @opencatbox
853 @category{Package draw}
854 @closecatbox
856 @end defvr
860 @anchor{colorbox}
861 @defvr {Graphic option} colorbox
862 Default value: @code{true}
864 If @code{colorbox} is @code{true}, a color scale without label is drawn together with 
865 @code{image} 2D objects, or coloured 3d objects. If @code{colorbox} is @code{false}, no 
866 color scale is shown. If @code{colorbox} is a string, a color scale with label is drawn.
868 Since this is a global graphics option, its position in the scene description
869 does not matter.
871 Example:
873 Color scale and images.
875 @example
876 (%i1) im: apply('matrix,
877                  makelist(makelist(random(200),i,1,30),i,1,30))$
878 (%i2) draw(
879           gr2d(image(im,0,0,30,30)),
880           gr2d(colorbox = false, image(im,0,0,30,30))
881       )$
882 @end example
883 @figure{draw_colorbox}
884 Color scale and 3D coloured object.
886 @example
887 (%i1) draw3d(
888         colorbox   = "Magnitude",
889         enhanced3d = true,
890         explicit(x^2+y^2,x,-1,1,y,-1,1))$
891 @end example
892 @figure{draw_colorbox2}
894 See also @mrefdot{palette_draw}
896 @opencatbox
897 @category{Package draw}
898 @closecatbox
900 @end defvr
905 @anchor{columns}
906 @defvr {Graphic option} columns
907 Default value: 1
909 @code{columns} is the number of columns in multiple plots.
911 Since this is a global graphics option, its position in the scene description
912 does not matter. It can be also used as an argument of function @code{draw}.
914 Example:
916 @example
917 (%i1) scene1: gr2d(title="Ellipse",
918                    nticks=30,
919                    parametric(2*cos(t),5*sin(t),t,0,2*%pi))$
920 (%i2) scene2: gr2d(title="Triangle",
921                    polygon([4,5,7],[6,4,2]))$
922 (%i3) draw(scene1, scene2, columns = 2)$
923 @end example
924 @figure{draw_columns}
926 @opencatbox
927 @category{Package draw}
928 @closecatbox
930 @end defvr
934 @anchor{contour}
935 @defvr {Graphic option} contour
936 Default value: @code{none}
938 Option @code{contour} enables the user to select where to plot contour lines.
939 Possible values are:
941 @itemize @bullet
943 @item
944 @code{none}:
945 no contour lines are plotted.
947 @item
948 @code{base}:
949 contour lines are projected on the xy plane.
951 @item
952 @code{surface}:
953 contour lines are plotted on the surface.
955 @item
956 @code{both}:
957 two contour lines are plotted: on the xy plane and on the surface.
959 @item
960 @code{map}:
961 contour lines are projected on the xy plane, and the view point is
962 set just in the vertical.
964 @end itemize
966 Since this is a global graphics option, its position in the scene description
967 does not matter.
969 Example:
971 @example
972 (%i1) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
973              contour_levels = 15,
974              contour        = both,
975              surface_hide   = true) $
976 @end example
977 @figure{draw_contour}
979 @example
980 (%i1) draw3d(explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
981              contour_levels = 15,
982              contour        = map
983       ) $
984 @end example
985 @figure{draw_contour2}
987 @opencatbox
988 @category{Package draw}
989 @closecatbox
991 @end defvr
995 @anchor{contour_levels}
996 @defvr {Graphic option} contour_levels
997 Default value: 5
999 This graphic option controls the way contours are drawn. 
1000 @code{contour_levels} can be set to a positive integer number, a list of three
1001 numbers or an arbitrary set of numbers:
1003 @itemize @bullet
1004 @item
1005 When option @code{contour_levels} is bounded to positive integer @var{n},
1006 @var{n} contour lines will be drawn at equal intervals. By default, five
1007 equally spaced contours are plotted.
1009 @item
1010 When option @code{contour_levels} is bounded to a list of length three of the
1011 form @code{[lowest,s,highest]}, contour lines are plotted from @code{lowest} 
1012 to @code{highest} in steps of @code{s}.
1014 @item
1015 When option @code{contour_levels} is bounded to a set of numbers of the
1016 form @code{@{n1, n2, ...@}}, contour lines are plotted at values @code{n1},
1017 @code{n2}, ...
1018 @end itemize
1020 Since this is a global graphics option, its position in the scene description
1021 does not matter.
1023 Examples:
1025 Ten equally spaced contour lines. The actual number of
1026 levels can be adjusted to give simple labels.
1027 @example
1028 (%i1) draw3d(color = green,
1029              explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
1030              contour_levels = 10,
1031              contour        = both,
1032              surface_hide   = true) $
1033 @end example
1036 From -8 to 8 in steps of 4.
1037 @example
1038 (%i1) draw3d(color = green,
1039              explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
1040              contour_levels = [-8,4,8],
1041              contour        = both,
1042              surface_hide   = true) $
1043 @end example
1045 Isolines at levels -7, -6, 0.8 and 5.
1046 @example
1047 (%i1) draw3d(color = green,
1048              explicit(20*exp(-x^2-y^2)-10,x,0,2,y,-3,3),
1049              contour_levels = @{-7, -6, 0.8, 5@},
1050              contour        = both,
1051              surface_hide   = true) $
1052 @end example
1054 See also @mrefdot{contour}
1056 @opencatbox
1057 @category{Package draw}
1058 @closecatbox
1060 @end defvr
1064 @anchor{data_file_name}
1065 @defvr {Graphic option} data_file_name
1066 Default value: @code{"data.gnuplot"}
1068 This is the name of the file with the numeric data needed
1069 by Gnuplot to build the requested plot.
1071 Since this is a global graphics option, its position in the scene description
1072 does not matter. It can be also used as an argument of function @code{draw}.
1074 See example in @code{gnuplot_file_name}.
1076 @opencatbox
1077 @category{Package draw}
1078 @closecatbox
1080 @end defvr
1084 @anchor{delay}
1085 @defvr {Graphic option} delay
1086 Default value: 5
1088 This is the delay in 1/100 seconds of frames in animated gif files.
1090 Since this is a global graphics option, its position in the scene description
1091 does not matter. It can be also used as an argument of function @code{draw}.
1093 Example:
1095 @example
1096 (%i1) draw(
1097         delay     = 100,
1098         file_name = "zzz",
1099         terminal  = 'animated_gif,
1100         gr2d(explicit(x^2,x,-1,1)),
1101         gr2d(explicit(x^3,x,-1,1)),
1102         gr2d(explicit(x^4,x,-1,1)));
1103 End of animation sequence
1104 (%o2)          [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
1105 @end example
1107 Option @code{delay} is only active in animated gif's; it is ignored in
1108 any other case.
1110 See also @mrefcomma{terminal} and @code{dimensions}.
1112 @opencatbox
1113 @category{Package draw}
1114 @closecatbox
1116 @end defvr
1120 @anchor{dimensions_draw}
1121 @defvr {Graphic option} dimensions
1122 Default value: @code{[600,500]}
1124 Dimensions of the output terminal. Its value is a list formed by
1125 the width and the height. The meaning of the two numbers depends on
1126 the terminal you are working with.
1128 With terminals @code{gif}, @code{animated_gif}, @code{png}, @code{jpg},
1129 @code{svg}, @code{screen}, @code{wxt}, and @code{aquaterm},
1130 the integers represent the number of points in each direction. If they
1131 are not integers, they are rounded.
1133 With terminals @code{eps}, @code{eps_color}, @code{pdf}, and 
1134 @code{pdfcairo}, both numbers represent hundredths of cm, which
1135 means that, by default, pictures in these formats are 6 cm in
1136 width and 5 cm in height.
1138 Since this is a global graphics option, its position in the scene description
1139 does not matter. It can be also used as an argument of function @code{draw}.
1141 Examples:
1143 Option @code{dimensions} applied to file output
1144 and to wxt canvas.
1146 @example
1147 (%i1) draw2d(
1148         dimensions = [300,300],
1149         terminal   = 'png,
1150         explicit(x^4,x,-1,1)) $
1151 (%i2) draw2d(
1152         dimensions = [300,300],
1153         terminal   = 'wxt,
1154         explicit(x^4,x,-1,1)) $
1155 @end example
1157 Option @code{dimensions} applied to eps output.
1158 We want an eps file with A4 portrait dimensions.
1160 @example
1161 (%i1) A4portrait: 100*[21, 29.7]$
1162 (%i2) draw3d(
1163         dimensions = A4portrait,
1164         terminal   = 'eps,
1165         explicit(x^2-y^2,x,-2,2,y,-2,2)) $
1166 @end example
1168 @opencatbox
1169 @category{Package draw}
1170 @closecatbox
1172 @end defvr
1176 @anchor{draw_realpart}
1177 @defvr {Graphic option} draw_realpart
1178 Default value: @code{true}
1180 When @code{true}, functions to be drawn are considered as complex functions whose
1181 real part value should be plotted; when @code{false}, nothing will be plotted when
1182 the function does not give a real value. 
1184 This option affects objects @mref{explicit} and @mref{parametric} in 2D and 3D, and
1185 @mrefdot{parametric_surface}
1187 Example:
1188 @example
1189 (%i1) draw2d(
1190         draw_realpart = false,
1191         explicit(sqrt(x^2  - 4*x) - x, x, -1, 5),
1192         color         = red,
1193         draw_realpart = true,
1194         parametric(x,sqrt(x^2  - 4*x) - x + 1, x, -1, 5) );
1195 @end example
1197 @opencatbox
1198 @category{Package draw}
1199 @closecatbox
1201 @end defvr
1205 @anchor{enhanced3d}
1206 @defvr {Graphic option} enhanced3d
1207 Default value: @code{none}
1209 If @code{enhanced3d} is @code{none}, surfaces are not colored in 3D plots.
1210 In order to get a colored surface, a list must be assigned to option
1211 @mrefcomma{enhanced3d} where the first element is an expression and the rest
1212 are the names of the variables or parameters used in that expression. A list such 
1213 @code{[f(x,y,z), x, y, z]} means that point @code{[x,y,z]} of the surface 
1214 is assigned number @code{f(x,y,z)}, which will be colored according to 
1215 the actual @code{palette}. For those 3D graphic objects defined in terms of
1216 parameters, it is possible to define the color number in terms of
1217 the parameters, as in @code{[f(u), u]}, as in objects @mref{parametric} and 
1218 @mrefcomma{tube} or @code{[f(u,v), u, v]}, as in object @code{parametric_surface}.
1219 While all 3D objects admit the model based on absolute coordinates,
1220 @code{[f(x,y,z), x, y, z]}, only two of them, namely @code{explicit}
1221 and @mrefcomma{elevation_grid} accept also models defined on the @code{[x,y]} coordinates,
1222 @code{[f(x,y), x, y]}. 3D graphic object @code{implicit} accepts only the
1223 @code{[f(x,y,z), x, y, z]} model. Object @code{points} accepts also the
1224 @code{[f(x,y,z), x, y, z]} model, but when points have a chronological nature,
1225 model @code{[f(k), k]} is also valid, being @code{k} an ordering parameter.
1227 When @code{enhanced3d} is assigned something different to @code{none}, options
1228 @code{color} and @code{surface_hide} are ignored.
1230 The names of the variables defined in the lists may be different to those
1231 used in the definitions of the graphic objects.
1233 In order to maintain back compatibility, @code{enhanced3d = false} is equivalent
1234 to @code{enhanced3d = none}, and @code{enhanced3d = true} is equivalent to 
1235 @code{enhanced3d = [z, x, y, z]}.  If an expression is given to @mrefcomma{enhanced3d}
1236 its variables must be the same used in the surface definition. This is not
1237 necessary when using lists.
1239 See option @code{palette} to learn how palettes are specified.
1241 Examples:
1243 @code{explicit} object with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1245 @example
1246 (%i1) draw3d(
1247          enhanced3d = [x-z/10,x,y,z],
1248          palette    = gray,
1249          explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
1250 @end example
1251 @figure{draw_enhanced3d}
1253 @code{explicit} object with coloring defined by the @code{[f(x,y), x, y]} model.
1254 The names of the variables defined in the lists may be different to those
1255 used in the definitions of the graphic objects; in this case, @code{r} corresponds
1256 to @code{x}, and @code{s} to @code{y}.
1258 @example
1259 (%i1) draw3d(
1260          enhanced3d = [sin(r*s),r,s],
1261          explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
1262 @end example
1263 @figure{draw_enhanced3d2}
1265 @code{parametric} object with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1267 @example
1268 (%i1) draw3d(
1269          nticks = 100,
1270          line_width = 2,
1271          enhanced3d = [if y>= 0 then 1 else 0, x, y, z],
1272          parametric(sin(u)^2,cos(u),u,u,0,4*%pi)) $
1273 @end example
1274 @figure{draw_enhanced3d3}
1276 @code{parametric} object with coloring defined by the @code{[f(u), u]} model.
1277 In this case, @code{(u-1)^2} is a shortcut for @code{[(u-1)^2,u]}.
1279 @example
1280 (%i1) draw3d(
1281          nticks = 60,
1282          line_width = 3,
1283          enhanced3d = (u-1)^2,
1284          parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2))$
1285 @end example
1286 @figure{draw_enhanced3d4}
1288 @code{elevation_grid} object with coloring defined by the @code{[f(x,y), x, y]} model.
1290 @example
1291 (%i1) m: apply(
1292            matrix,
1293            makelist(makelist(cos(i^2/80-k/30),k,1,30),i,1,20)) $
1294 (%i2) draw3d(
1295          enhanced3d = [cos(x*y*10),x,y],
1296          elevation_grid(m,-1,-1,2,2),
1297          xlabel = "x",
1298          ylabel = "y");
1299 @end example
1300 @figure{draw_enhanced3d5}
1302 @code{tube} object with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1304 @example
1305 (%i1) draw3d(
1306          enhanced3d = [cos(x-y),x,y,z],
1307          palette = gray,
1308          xu_grid = 50,
1309          tube(cos(a), a, 0, 1, a, 0, 4*%pi) )$
1310 @end example
1311 @figure{draw_enhanced3d6}
1313 @code{tube} object with coloring defined by the @code{[f(u), u]} model.
1314 Here, @code{enhanced3d = -a} would be the shortcut for @code{enhanced3d = [-foo,foo]}.
1316 @example
1317 (%i1) draw3d(
1318          capping = [true, false],
1319          palette = [26,15,-2],
1320          enhanced3d = [-foo, foo],
1321          tube(a, a, a^2, 1, a, -2, 2) )$
1322 @end example
1323 @figure{draw_enhanced3d7}
1325 @code{implicit} and @code{points} objects with coloring defined by the @code{[f(x,y,z), x, y, z]} model.
1327 @example
1328 (%i1) draw3d(
1329          enhanced3d = [x-y,x,y,z],
1330          implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015,
1331                   x,-1,1,y,-1.2,2.3,z,-1,1)) $
1332 (%i2) m: makelist([random(1.0),random(1.0),random(1.0)],k,1,2000)$
1333 @end example
1334 @figure{draw_enhanced3d9}
1335 @example
1336 (%i3) draw3d(
1337          point_type = filled_circle,
1338          point_size = 2,
1339          enhanced3d = [u+v-w,u,v,w],
1340          points(m) ) $
1341 @end example
1342 @figure{draw_enhanced3d10}
1344 When points have a chronological nature, model @code{[f(k), k]} is also valid,
1345 being @code{k} an ordering parameter.
1347 @example
1348 (%i1) m:makelist([random(1.0), random(1.0), random(1.0)],k,1,5)$
1349 (%i2) draw3d(
1350          enhanced3d = [sin(j), j],
1351          point_size = 3,
1352          point_type = filled_circle,
1353          points_joined = true,
1354          points(m)) $
1355 @end example
1356 @figure{draw_enhanced3d11}
1358 @opencatbox
1359 @category{Package draw}
1360 @closecatbox
1362 @end defvr
1367 @anchor{error_type}
1368 @defvr {Graphic option} error_type
1369 Default value: @code{y}
1371 Depending on its value, which can be @code{x}, @code{y}, or @code{xy},
1372 graphic object @code{errors} will draw points with horizontal, vertical,
1373 or both, error bars. When @code{error_type=boxes}, boxes will be drawn
1374 instead of crosses.
1376 See also @mrefdot{errors}
1377 @end defvr
1381 @anchor{file_name}
1382 @defvr {Graphic option} file_name
1383 Default value: @code{"maxima_out"}
1385 This is the name of the file where terminals @code{png}, @code{jpg}, @code{gif},
1386 @code{eps}, @code{eps_color}, @code{pdf}, @code{pdfcairo} and @code{svg}
1387 will save the graphic.
1389 Since this is a global graphics option, its position in the scene description
1390 does not matter. It can be also used as an argument of function @code{draw}.
1392 Example:
1394 @example
1395 (%i1) draw2d(file_name = "myfile",
1396              explicit(x^2,x,-1,1),
1397              terminal  = 'png)$
1398 @end example
1400 See also @mrefcomma{terminal}  @mrefdot{dimensions_draw}
1402 @opencatbox
1403 @category{Package draw}
1404 @closecatbox
1406 @end defvr
1410 @anchor{fill_color}
1411 @defvr {Graphic option} fill_color
1412 Default value: @code{"red"}
1414 @code{fill_color} specifies the color for filling polygons and
1415 2d @code{explicit} functions.
1417 See @code{color} to learn how colors are specified.
1419 @opencatbox
1420 @category{Package draw}
1421 @closecatbox
1423 @end defvr
1428 @anchor{fill_density}
1429 @defvr {Graphic option} fill_density
1430 Default value: 0
1432 @code{fill_density} is a number between 0 and 1 that specifies
1433 the intensity of the @code{fill_color} in @code{bars} objects.
1435 See @code{bars} for examples.
1436 @end defvr
1441 @anchor{filled_func}
1442 @defvr {Graphic option} filled_func
1443 Default value: @code{false}
1445 Option @code{filled_func} controls how regions limited by functions
1446 should be filled. When @code{filled_func} is @code{true}, the region
1447 bounded by the function defined with object @code{explicit} and the
1448 bottom of the graphic window is filled with @code{fill_color}. When 
1449 @code{filled_func} contains a function expression, then the region bounded
1450 by this function and the function defined with object @code{explicit} 
1451 will be filled. By default, explicit functions are not filled.
1453 A useful special case is @code{filled_func=0}, which generates the region 
1454 bond by the horizontal axis and the explicit function.
1456 This option affects only the 2d graphic object @mrefdot{explicit}
1458 Example:
1460 Region bounded by an @code{explicit} object and the bottom of the
1461 graphic window.
1462 @example
1463 (%i1) draw2d(fill_color  = red,
1464              filled_func = true,
1465              explicit(sin(x),x,0,10) )$
1466 @end example
1467 @figure{draw_filledfunc}
1469 Region bounded by an @code{explicit} object and the function
1470 defined by option @code{filled_func}. Note that the variable in
1471 @code{filled_func} must be the same as that used in @code{explicit}.
1472 @example
1473 (%i1) draw2d(fill_color  = grey,
1474              filled_func = sin(x),
1475              explicit(-sin(x),x,0,%pi));
1476 @end example
1477 @figure{draw_filledfunc2}
1478 See also @mref{fill_color} and @mrefdot{explicit}
1480 @opencatbox
1481 @category{Package draw}
1482 @closecatbox
1484 @end defvr
1488 @anchor{font}
1489 @defvr {Graphic option} font
1490 Default value: @code{""} (empty string)
1492 This option can be used to set the font face to be used by the terminal.
1493 Only one font face and size can be used throughout the plot.
1495 Since this is a global graphics option, its position in the scene description
1496 does not matter.
1498 See also @mrefdot{font_size}
1500 Gnuplot doesn't handle fonts by itself, it leaves this task to the
1501 support libraries of the different terminals, each one with its own
1502 philosophy about it. A brief summary follows:
1504 @itemize @bullet
1505 @item
1506 @i{x11}:
1507 Uses the normal x11 font server mechanism.
1509 Example:
1510 @example
1511 (%i1) draw2d(font      = "Arial", 
1512              font_size = 20,
1513              label(["Arial font, size 20",1,1]))$
1514 @end example
1516 @item
1517 @i{windows}:
1518 The windows terminal doesn't support changing of fonts from inside the plot.
1519 Once the plot has been generated, the font can be changed right-clicking on
1520 the menu of the graph window.
1522 @item
1523 @i{png, jpeg, gif}:
1524 The @i{libgd} library uses the font path stored in the environment
1525 variable @code{GDFONTPATH}; in this case, it is only necessary to
1526 set option @code{font} to the font's name. It is also possible to
1527 give the complete path to the font file.
1529 Examples:
1531 Option @code{font} can be given the complete path to the font file:
1532 @example
1533 (%i1) path: "/usr/share/fonts/truetype/freefont/" $
1534 (%i2) file: "FreeSerifBoldItalic.ttf" $
1535 (%i3) draw2d(
1536         font      = concat(path, file), 
1537         font_size = 20,
1538         color     = red,
1539         label(["FreeSerifBoldItalic font, size 20",1,1]),
1540         terminal  = png)$
1541 @end example
1543 If environment variable @env{GDFONTPATH} is set to the
1544 path where font files are allocated, it is possible to
1545 set graphic option @code{font} to the name of the font.
1546 @example
1547 (%i1) draw2d(
1548         font      = "FreeSerifBoldItalic", 
1549         font_size = 20,
1550         color     = red,
1551         label(["FreeSerifBoldItalic font, size 20",1,1]),
1552         terminal  = png)$
1553 @end example
1555 @item
1556 @i{Postscript}:
1557 Standard Postscript fonts are:@*
1558 @code{"Times-Roman"}, @code{"Times-Italic"}, @code{"Times-Bold"},
1559 @code{"Times-BoldItalic"},@*
1560 @code{"Helvetica"}, @code{"Helvetica-Oblique"}, @code{"Helvetica-Bold"},@*
1561 @code{"Helvetic-BoldOblique"}, @code{"Courier"},
1562 @code{"Courier-Oblique"}, @code{"Courier-Bold"},@*
1563 and @code{"Courier-BoldOblique"}.
1564   
1565 Example:
1566 @example
1567 (%i1) draw2d(
1568         font      = "Courier-Oblique", 
1569         font_size = 15,
1570         label(["Courier-Oblique font, size 15",1,1]),
1571         terminal = eps)$
1572 @end example
1574 @item
1575 @i{pdf}:
1576 Uses same fonts as @i{Postscript}.
1578 @item
1579 @i{pdfcairo}:
1580 Uses same fonts as @i{wxt}.
1582 @item
1583 @i{wxt}:
1584 The @i{pango} library finds fonts via the @code{fontconfig} utility.
1586 @item
1587 @i{aqua}:
1588 Default is @code{"Times-Roman"}.
1589 @end itemize
1591 The gnuplot documentation is an important source of information about terminals and fonts.
1593 @opencatbox
1594 @category{Package draw}
1595 @closecatbox
1597 @end defvr
1601 @anchor{font_size}
1602 @defvr {Graphic option} font_size
1603 Default value: 10
1605 This option can be used to set the font size to be used by the terminal.
1606 Only one font face and size can be used throughout the plot. @code{font_size} is
1607 active only when option @code{font} is not equal to the empty string.
1609 Since this is a global graphics option, its position in the scene description
1610 does not matter.
1612 See also @mrefdot{font}
1614 @opencatbox
1615 @category{Package draw}
1616 @closecatbox
1618 @end defvr
1622 @anchor{gnuplot_file_name}
1623 @defvr {Graphic option} gnuplot_file_name
1624 Default value: @code{"maxout_xxx.gnuplot"} with @code{"xxx"}
1625 being a number that is unique to each concurrently-running
1626 maxima process.
1628 This is the name of the file with the necessary commands to
1629 be processed by Gnuplot.
1631 Since this is a global graphics option, its position in the scene description
1632 does not matter. It can be also used as an argument of function @code{draw}.
1634 Example:
1636 @example
1637 (%i1) draw2d(
1638        file_name = "my_file",
1639        gnuplot_file_name = "my_commands_for_gnuplot",
1640        data_file_name    = "my_data_for_gnuplot",
1641        terminal          = png,
1642        explicit(x^2,x,-1,1)) $
1643 @end example
1645 See also @mrefdot{data_file_name}
1647 @opencatbox
1648 @category{Package draw}
1649 @closecatbox
1651 @end defvr
1655 @anchor{grid_draw}
1656 @defvr {Graphic option} grid
1657 Default value: @code{false}
1659 If @code{grid} is @code{not false}, a grid will be drawn on the @var{xy} plane.
1660 If @code{grid} is assigned true, one grid line per tick of each axis is drawn.
1661 If @code{grid} is assigned a list @code{nx,ny} with @code{[nx,ny] > [0,0]}
1662 instead @code{nx} lines per tick of the x axis and @code{ny} lines per tick of
1663 the y axis are drawn.
1665 Since this is a global graphics option, its position in the scene description
1666 does not matter.
1668 Example:
1670 @example
1671 (%i1) draw2d(grid = true,
1672              explicit(exp(u),u,-2,2))$
1673 @end example
1674 @figure{draw_grid}
1676 @example
1677 (%i1) draw2d(grid = [2,2],
1678              explicit(sin(x),x,0,2*%pi))$
1679 @end example
1680 @figure{draw_grid2}
1682 @opencatbox
1683 @category{Package draw}
1684 @closecatbox
1686 @end defvr
1690 @anchor{head_angle}
1691 @defvr {Graphic option} head_angle
1692 Default value: 45
1694 @code{head_angle} indicates the angle, in degrees, between the arrow heads and
1695 the segment.
1697 This option is relevant only for @code{vector} objects.
1699 Example:
1701 @example
1702 (%i1) draw2d(xrange      = [0,10],
1703              yrange      = [0,9],
1704              head_length = 0.7,
1705              head_angle  = 10,
1706              vector([1,1],[0,6]),
1707              head_angle  = 20,
1708              vector([2,1],[0,6]),
1709              head_angle  = 30,
1710              vector([3,1],[0,6]),
1711              head_angle  = 40,
1712              vector([4,1],[0,6]),
1713              head_angle  = 60,
1714              vector([5,1],[0,6]),
1715              head_angle  = 90,
1716              vector([6,1],[0,6]),
1717              head_angle  = 120,
1718              vector([7,1],[0,6]),
1719              head_angle  = 160,
1720              vector([8,1],[0,6]),
1721              head_angle  = 180,
1722              vector([9,1],[0,6]) )$
1723 @end example
1724 @figure{draw_head_angle}
1726 See also @mrefcomma{head_both}  @mrefcomma{head_length}  and @mrefdot{head_type} 
1728 @opencatbox
1729 @category{Package draw}
1730 @closecatbox
1732 @end defvr
1736 @anchor{head_both}
1737 @defvr {Graphic option} head_both
1738 Default value: @code{false}
1740 If @code{head_both} is @code{true}, vectors are plotted with two arrow heads.
1741 If @code{false}, only one arrow is plotted.
1743 This option is relevant only for @code{vector} objects.
1745 Example:
1747 @example
1748 (%i1) draw2d(xrange      = [0,8],
1749              yrange      = [0,8],
1750              head_length = 0.7,
1751              vector([1,1],[6,0]),
1752              head_both   = true,
1753              vector([1,7],[6,0]) )$
1754 @end example
1755 @figure{draw_head_both}
1757 See also @mrefcomma{head_length}  @mrefcomma{head_angle}  and @mrefdot{head_type} 
1759 @opencatbox
1760 @category{Package draw}
1761 @closecatbox
1763 @end defvr
1767 @anchor{head_length}
1768 @defvr {Graphic option} head_length
1769 Default value: 2
1771 @code{head_length} indicates, in @var{x}-axis units, the length of arrow heads.
1773 This option is relevant only for @code{vector} objects.
1775 Example:
1777 @example
1778 (%i1) draw2d(xrange      = [0,12],
1779              yrange      = [0,8],
1780              vector([0,1],[5,5]),
1781              head_length = 1,
1782              vector([2,1],[5,5]),
1783              head_length = 0.5,
1784              vector([4,1],[5,5]),
1785              head_length = 0.25,
1786              vector([6,1],[5,5]))$
1787 @end example
1788 @figure{draw_head_length}
1790 See also @mrefcomma{head_both}  @mrefcomma{head_angle}  and @mrefdot{head_type} 
1792 @opencatbox
1793 @category{Package draw}
1794 @closecatbox
1796 @end defvr
1802 @anchor{head_type}
1803 @defvr {Graphic option} head_type
1804 Default value: @code{filled}
1806 @code{head_type} is used to specify how arrow heads are plotted. Possible
1807 values are: @code{filled} (closed and filled arrow heads), @code{empty}
1808 (closed but not filled arrow heads), and @code{nofilled} (open arrow heads).
1810 This option is relevant only for @code{vector} objects.
1812 Example:
1814 @example
1815 (%i1) draw2d(xrange      = [0,12],
1816              yrange      = [0,10],
1817              head_length = 1,
1818              vector([0,1],[5,5]), /* default type */
1819              head_type = 'empty,
1820              vector([3,1],[5,5]),
1821              head_type = 'nofilled,
1822              vector([6,1],[5,5]))$
1823 @end example
1824 @figure{draw_head_type}
1826 See also @mrefcomma{head_both}  @mrefcomma{head_angle}  and @mrefdot{head_length} 
1828 @opencatbox
1829 @category{Package draw}
1830 @closecatbox
1832 @end defvr
1836 @anchor{interpolate_color}
1837 @defvr {Graphic option} interpolate_color
1838 Default value: @code{false}
1840 This option is relevant only when @code{enhanced3d} is not @code{false}.
1842 When @code{interpolate_color} is @code{false}, surfaces are colored with
1843 homogeneous quadrangles. When @code{true}, color transitions are smoothed
1844 by interpolation.
1846 @code{interpolate_color} also accepts a list of two numbers, @code{[m,n]}.
1847 For positive @var{m} and @var{n}, each quadrangle or triangle is interpolated
1848 @var{m} times and @var{n} times in the respective direction. For negative
1849 @var{m} and @var{n}, the interpolation frequency is chosen so that there will be at least
1850 @var{|m|} and @var{|n|} points drawn; you can consider this as a special gridding function.
1851 Zeros, i.e. @code{interpolate_color=[0,0]}, will automatically choose an
1852 optimal number of interpolated surface points.
1854 Also, @code{interpolate_color=true} is equivalent to @code{interpolate_color=[0,0]}.
1856 Examples:
1858 Color interpolation with explicit functions.
1860 @example
1861 (%i1) draw3d(
1862         enhanced3d   = sin(x*y),
1863         explicit(20*exp(-x^2-y^2)-10, x ,-3, 3, y, -3, 3)) $
1864 @end example
1865 @figure{draw_interpolate_color}
1866 @example
1867 (%i2) draw3d(
1868         interpolate_color = true,
1869         enhanced3d   = sin(x*y),
1870         explicit(20*exp(-x^2-y^2)-10, x ,-3, 3, y, -3, 3)) $
1871 @end example
1872 @figure{draw_interpolate_color2}
1873 @example
1874 (%i3) draw3d(
1875         interpolate_color = [-10,0],
1876         enhanced3d   = sin(x*y),
1877         explicit(20*exp(-x^2-y^2)-10, x ,-3, 3, y, -3, 3)) $
1878 @end example
1879 @figure{draw_interpolate_color3}
1881 Color interpolation with the @code{mesh} graphic object.
1883 Interpolating colors in parametric surfaces can give unexpected results.
1885 @example
1886 (%i1) draw3d( 
1887         enhanced3d = true,
1888         mesh([[1,1,3],   [7,3,1],[12,-2,4],[15,0,5]],
1889              [[2,7,8],   [4,3,1],[10,5,8], [12,7,1]],
1890              [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
1891 @end example
1892 @figure{draw_interpolate_color4}
1893 @example
1894 (%i2) draw3d( 
1895         enhanced3d        = true,
1896         interpolate_color = true,
1897         mesh([[1,1,3],   [7,3,1],[12,-2,4],[15,0,5]],
1898              [[2,7,8],   [4,3,1],[10,5,8], [12,7,1]],
1899              [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
1900 @end example
1901 @figure{draw_interpolate_color5}
1902 @example
1903 (%i3) draw3d( 
1904         enhanced3d        = true,
1905         interpolate_color = true,
1906         view=map,
1907         mesh([[1,1,3],   [7,3,1],[12,-2,4],[15,0,5]],
1908              [[2,7,8],   [4,3,1],[10,5,8], [12,7,1]],
1909              [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
1910 @end example
1911 @figure{draw_interpolate_color6}
1913 See also @mrefdot{enhanced3d} 
1915 @opencatbox
1916 @category{Package draw}
1917 @closecatbox
1919 @end defvr
1923 @anchor{ip_grid}
1924 @defvr {Graphic option} ip_grid
1925 Default value: @code{[50, 50]}
1927 @code{ip_grid} sets the grid for the first sampling in implicit plots.
1929 This option is relevant only for @code{implicit} objects.
1931 @opencatbox
1932 @category{Package draw}
1933 @closecatbox
1935 @end defvr
1939 @anchor{ip_grid_in}
1940 @defvr {Graphic option} ip_grid_in
1941 Default value: @code{[5, 5]}
1943 @code{ip_grid_in} sets the grid for the second sampling in implicit plots.
1945 This option is relevant only for @code{implicit} objects.
1947 @opencatbox
1948 @category{Package draw}
1949 @closecatbox
1951 @end defvr
1955 @anchor{key}
1956 @defvr {Graphic option} key
1957 Default value: @code{""} (empty string)
1959 @code{key} is the name of a function in the legend. If @code{key} is an
1960 empty string, no key is assigned to the function.
1962 This option affects the following graphic objects:
1963 @itemize @bullet
1964 @item
1965 @code{gr2d}: @mrefcomma{points} @mrefcomma{polygon} @mrefcomma{rectangle}
1966 @mrefcomma{ellipse} @mrefcomma{vector} @mrefcomma{explicit} @mrefcomma{implicit}
1967 @mref{parametric} and @mrefdot{polar}
1969 @item
1970 @code{gr3d}: @mrefcomma{points} @mrefcomma{explicit} @mref{parametric}
1971 and @mrefdot{parametric_surface}
1972 @end itemize
1974 Example:
1976 @example
1977 (%i1) draw2d(key   = "Sinus",
1978              explicit(sin(x),x,0,10),
1979              key   = "Cosinus",
1980              color = red,
1981              explicit(cos(x),x,0,10) )$
1982 @end example
1983 @figure{draw_key}
1984 @opencatbox
1985 @category{Package draw}
1986 @closecatbox
1988 @end defvr
1993 @anchor{key_pos}
1994 @defvr {Graphic option} key_pos
1995 Default value: @code{""} (empty string)
1997 @code{key_pos} defines at which position the legend will be drawn. If @code{key} is an
1998 empty string, @code{"top_right"} is used.
1999 Available position specifiers are: @code{top_left}, @code{top_center}, @code{top_right},
2000 @code{center_left}, @code{center}, @code{center_right},
2001 @code{bottom_left}, @code{bottom_center}, and @code{bottom_right}.
2003 Since this is a global graphics option, its position in the scene description
2004 does not matter.
2006 Example:
2008 @example
2009 (%i1) draw2d(
2010         key_pos = top_left,
2011         key   = "x",
2012         explicit(x,  x,0,10),
2013         color= red,
2014         key   = "x squared",
2015         explicit(x^2,x,0,10))$
2016 (%i3) draw3d(
2017         key_pos = center,
2018         key   = "x",
2019         explicit(x+y,x,0,10,y,0,10),
2020         color= red,
2021         key   = "x squared",
2022         explicit(x^2+y^2,x,0,10,y,0,10))$
2023 @end example
2024 @figure{draw_key_pos}
2026 @opencatbox
2027 @category{Package draw}
2028 @closecatbox
2030 @end defvr
2034 @anchor{label_alignment}
2035 @defvr {Graphic option} label_alignment
2036 Default value: @code{center}
2038 @code{label_alignment} is used to specify where to write labels with
2039 respect to the given coordinates. Possible values are: @code{center},
2040 @code{left}, and @code{right}.
2042 This option is relevant only for @code{label} objects.
2044 Example:
2046 @example
2047 (%i1) draw2d(xrange          = [0,10],
2048              yrange          = [0,10],
2049              points_joined   = true,
2050              points([[5,0],[5,10]]),
2051              color           = blue,
2052              label(["Centered alignment (default)",5,2]),
2053              label_alignment = 'left,
2054              label(["Left alignment",5,5]),
2055              label_alignment = 'right,
2056              label(["Right alignment",5,8]))$
2057 @end example
2058 @figure{draw_label_alignment}
2060 See also @mrefcomma{label_orientation}  and @code{color} 
2062 @opencatbox
2063 @category{Package draw}
2064 @closecatbox
2066 @end defvr
2070 @anchor{label_orientation}
2071 @defvr {Graphic option} label_orientation
2072 Default value: @code{horizontal}
2074 @code{label_orientation} is used to specify orientation of labels.
2075 Possible values are: @code{horizontal}, and @code{vertical}.
2077 This option is relevant only for @code{label} objects.
2079 Example:
2081 In this example, a dummy point is added to get an image.
2082 Package @code{draw} needs always data to draw an scene.
2083 @example
2084 (%i1) draw2d(xrange     = [0,10],
2085              yrange     = [0,10],
2086              point_size = 0,
2087              points([[5,5]]),
2088              color      = navy,
2089              label(["Horizontal orientation (default)",5,2]),
2090              label_orientation = 'vertical,
2091              color             = "#654321",
2092              label(["Vertical orientation",1,5]))$
2093 @end example
2094 @figure{draw_label_orientation}
2096 See also @mref{label_alignment} and @code{color} 
2098 @opencatbox
2099 @category{Package draw}
2100 @closecatbox
2102 @end defvr
2106 @anchor{line_type}
2107 @defvr {Graphic option} line_type
2108 Default value: @code{solid}
2110 @code{line_type} indicates how lines are displayed; possible values are
2111 @code{solid} and @code{dots}, both available in all terminals, and
2112 @code{dashes}, @code{short_dashes}, @code{short_long_dashes}, @code{short_short_long_dashes}, 
2113 and @code{dot_dash}, which are not available in @code{png}, @code{jpg}, and @code{gif} terminals. 
2115 This option affects the following graphic objects:
2116 @itemize @bullet
2117 @item
2118 @code{gr2d}: @mrefcomma{points} @mrefcomma{polygon} @mrefcomma{rectangle}
2119 @mrefcomma{ellipse} @mrefcomma{vector} @mrefcomma{explicit} @mrefcomma{implicit} 
2120 @mref{parametric} and @mrefdot{polar}
2122 @item
2123 @code{gr3d}: @mrefcomma{points} @mrefcomma{explicit} @mref{parametric} and @mrefdot{parametric_surface}
2124 @end itemize
2126 Example:
2128 @example
2129 (%i1) draw2d(line_type = dots,
2130              explicit(1 + x^2,x,-1,1),
2131              line_type = solid, /* default */
2132              explicit(2 + x^2,x,-1,1))$
2133 @end example
2134 @figure{draw_line_type}
2136 See also @mrefdot{line_width}
2138 @opencatbox
2139 @category{Package draw}
2140 @closecatbox
2142 @end defvr
2146 @anchor{line_width}
2147 @defvr {Graphic option} line_width
2148 Default value: 1
2150 @code{line_width} is the width of plotted lines.
2151 Its value must be a positive number.
2153 This option affects the following graphic objects:
2154 @itemize @bullet
2155 @item
2156 @code{gr2d}: @mrefcomma{points} @mrefcomma{polygon} @mrefcomma{rectangle} 
2157 @mrefcomma{ellipse} @mrefcomma{vector} @mrefcomma{explicit} @mrefcomma{implicit} 
2158 @mref{parametric} and @mrefdot{polar}
2160 @item
2161 @code{gr3d}: @mref{points} and @mrefdot{parametric}
2162 @end itemize
2164 Example:
2166 @example
2167 (%i1) draw2d(explicit(x^2,x,-1,1), /* default width */
2168              line_width = 5.5,
2169              explicit(1 + x^2,x,-1,1),
2170              line_width = 10,
2171              explicit(2 + x^2,x,-1,1))$
2172 @end example
2173 @figure{draw_line_width}
2175 See also @mrefdot{line_type}
2177 @opencatbox
2178 @category{Package draw}
2179 @closecatbox
2181 @end defvr
2185 @anchor{logcb}
2186 @defvr {Graphic option} logcb
2187 Default value: @code{false}
2189 If @mref{logcb} is @code{true}, the tics in the colorbox will be drawn in the
2190 logarithmic scale.
2192 When @code{enhanced3d} or @code{colorbox} is @code{false}, option @code{logcb} has
2193 no effect.
2195 Since this is a global graphics option, its position in the scene description
2196 does not matter.
2198 Example:
2200 @example
2201 (%i1) draw3d (
2202         enhanced3d = true,
2203         color      = green,
2204         logcb = true,
2205         logz  = true,
2206         palette = [-15,24,-9],
2207         explicit(exp(x^2-y^2), x,-2,2,y,-2,2)) $
2208 @end example
2209 @figure{draw_logcb}
2211 See also @mrefcomma{enhanced3d}  @mref{colorbox} and @mrefdot{cbrange}
2213 @opencatbox
2214 @category{Package draw}
2215 @closecatbox
2217 @end defvr
2221 @anchor{logx_draw}
2222 @defvr {Graphic option} logx
2223 Default value: @code{false}
2225 If @code{logx} is @code{true}, the @var{x} axis will be drawn in the
2226 logarithmic scale.
2228 Since this is a global graphics option, its position in the scene description
2229 does not matter, with the exception that it should be written before any 
2230 2D @code{explicit} object, so that @code{draw} can produce a better plot.
2232 Example:
2234 @example
2235 (%i1) draw2d(logx = true,
2236              explicit(log(x),x,0.01,5))$
2237 @end example
2239 See also @mrefcomma{logy}  @mrefcomma{logx_secondary}  @mrefcomma{logy_secondary}  and @mrefdot{logz}
2241 @opencatbox
2242 @category{Package draw}
2243 @closecatbox
2245 @end defvr
2249 @anchor{logx_secondary}
2250 @defvr {Graphic option} logx_secondary
2251 Default value: @code{false}
2253 If @code{logx_secondary} is @code{true}, the secondary @var{x} axis 
2254 will be drawn in the logarithmic scale.
2256 This option is relevant only for 2d scenes.
2258 Since this is a global graphics option, its position in the scene description
2259 does not matter.
2261 Example:
2263 @example
2264 (%i1) draw2d(
2265         grid = true,
2266         key="x^2, linear scale",
2267         color=red,
2268         explicit(x^2,x,1,100),
2269         xaxis_secondary = true,
2270         xtics_secondary = true,
2271         logx_secondary  = true,
2272         key = "x^2, logarithmic x scale",
2273         color = blue,
2274         explicit(x^2,x,1,100) )$
2275 @end example
2276 @figure{draw_logx_secondary}
2278 See also @mrefcomma{logx_draw}  @mrefcomma{logy_draw}  @mrefcomma{logy_secondary}  and @mrefdot{logz}
2280 @opencatbox
2281 @category{Package draw}
2282 @closecatbox
2284 @end defvr
2288 @anchor{logy_draw}
2289 @defvr {Graphic option} logy
2290 Default value: @code{false}
2292 If @code{logy} is @code{true}, the @var{y} axis will be drawn in the
2293 logarithmic scale.
2295 Since this is a global graphics option, its position in the scene description
2296 does not matter.
2298 Example:
2300 @example
2301 (%i1) draw2d(logy = true,
2302              explicit(exp(x),x,0,5))$
2303 @end example
2305 See also @mrefcomma{logx_draw}  @mrefcomma{logx_secondary}  @mrefcomma{logy_secondary}  and @mrefdot{logz}
2307 @opencatbox
2308 @category{Package draw}
2309 @closecatbox
2311 @end defvr
2315 @anchor{logy_secondary}
2316 @defvr {Graphic option} logy_secondary
2317 Default value: @code{false}
2319 If @code{logy_secondary} is @code{true}, the secondary @var{y} axis 
2320 will be drawn in the logarithmic scale.
2322 This option is relevant only for 2d scenes.
2324 Since this is a global graphics option, its position in the scene description
2325 does not matter.
2327 Example:
2329 @example
2330 (%i1) draw2d(
2331         grid = true,
2332         key="x^2, linear scale",
2333         color=red,
2334         explicit(x^2,x,1,100),
2335         yaxis_secondary = true,
2336         ytics_secondary = true,
2337         logy_secondary  = true,
2338         key = "x^2, logarithmic y scale",
2339         color = blue,
2340         explicit(x^2,x,1,100) )$
2341 @end example
2343 See also @mrefcomma{logx_draw}  @mrefcomma{logy_draw}  @mrefcomma{logx_secondary}  and @mrefdot{logz}
2345 @opencatbox
2346 @category{Package draw}
2347 @closecatbox
2349 @end defvr
2353 @anchor{logz}
2354 @defvr {Graphic option} logz
2355 Default value: @code{false}
2357 If @code{logz} is @code{true}, the @var{z} axis will be drawn in the
2358 logarithmic scale.
2360 Since this is a global graphics option, its position in the scene description
2361 does not matter.
2363 Example:
2365 @example
2366 (%i1) draw3d(logz = true,
2367              explicit(exp(u^2+v^2),u,-2,2,v,-2,2))$
2368 @end example
2370 See also @mref{logx_draw} and @mrefdot{logy_draw}
2372 @opencatbox
2373 @category{Package draw}
2374 @closecatbox
2376 @end defvr
2380 @defvr {Graphic option} nticks
2381 Default value: 29
2383 In 2d, @code{nticks} gives the initial number of points used by the
2384 adaptive plotting routine for explicit objects. It is also the
2385 number of points that will be shown in parametric and polar curves.
2387 This option affects the following graphic objects:
2388 @itemize @bullet
2389 @item
2390 @code{gr2d}: @mrefcomma{ellipse} @mrefcomma{explicit} @mref{parametric} and @mrefdot{polar}
2392 @item
2393 @code{gr3d}: @mrefdot{parametric}
2394 @end itemize
2396 See also @code{adapt_depth}
2398 Example:
2400 @example
2401 (%i1) draw2d(transparent = true,
2402              ellipse(0,0,4,2,0,180),
2403              nticks = 5,
2404              ellipse(0,0,4,2,180,180) )$
2405 @end example
2406 @figure{draw_nticks}
2408 @opencatbox
2409 @category{Package draw}
2410 @closecatbox
2412 @end defvr
2416 @anchor{palette_draw}
2417 @defvr {Graphic option} palette
2418 Default value: @code{color}
2420 @code{palette} indicates how to map gray levels onto color components.
2421 It works together with option @code{enhanced3d} in 3D graphics,
2422 who associates every point of a surfaces to a real number or gray level.
2423 It also works with gray images. With @code{palette}, levels are transformed into colors.
2425 There are two ways for defining these transformations.
2427 First, @code{palette} can be a vector of length three with components 
2428 ranging from -36 to +36; each value is an index for a formula mapping the levels
2429 onto red, green and blue colors, respectively:
2430 @example
2431  0: 0               1: 0.5           2: 1
2432  3: x               4: x^2           5: x^3
2433  6: x^4             7: sqrt(x)       8: sqrt(sqrt(x))
2434  9: sin(90x)       10: cos(90x)     11: |x-0.5|
2435 12: (2x-1)^2       13: sin(180x)    14: |cos(180x)|
2436 15: sin(360x)      16: cos(360x)    17: |sin(360x)|
2437 18: |cos(360x)|    19: |sin(720x)|  20: |cos(720x)|
2438 21: 3x             22: 3x-1         23: 3x-2
2439 24: |3x-1|         25: |3x-2|       26: (3x-1)/2 
2440 27: (3x-2)/2       28: |(3x-1)/2|   29: |(3x-2)/2|
2441 30: x/0.32-0.78125 31: 2*x-0.84     32: 4x;1;-2x+1.84;x/0.08-11.5
2442 33: |2*x - 0.5|    34: 2*x          35: 2*x - 0.5
2443 36: 2*x - 1
2444 @end example
2445 negative numbers mean negative colour component.
2446 @code{palette = gray} and @code{palette = color} are short cuts for
2447 @code{palette = [3,3,3]} and @code{palette = [7,5,15]}, respectively.
2449 Second, @code{palette} can be an user defined lookup table. In this case,
2450 the format for building a lookup table of length @code{n} is
2451 @code{palette=[color_1, color_2, ..., color_n]}, where @code{color_i} is
2452 a well formed color (see option @code{color}) such that @code{color_1} is
2453 assigned to the lowest gray level and @code{color_n} to the highest. The rest
2454 of colors are interpolated.
2456 Since this is a global graphics option, its position in the scene description
2457 does not matter.
2459 Examples:
2461 It works together with option @code{enhanced3d} in 3D graphics.
2463 @example
2464 (%i1) draw3d(
2465         enhanced3d = [z-x+2*y,x,y,z],
2466         palette = [32, -8, 17],
2467         explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3))$
2468 @end example
2469 @figure{draw_palette}
2471 It also works with gray images.
2473 @example
2474 (%i1) im: apply(
2475            'matrix,
2476             makelist(makelist(random(200),i,1,30),i,1,30))$
2477 (%i2) /* palette = color, default */
2478       draw2d(image(im,0,0,30,30))$
2479 (%i3) draw2d(palette = gray, image(im,0,0,30,30))$
2480 (%i4) draw2d(palette = [15,20,-4],
2481              colorbox=false,
2482              image(im,0,0,30,30))$
2483 @end example
2484 @figure{draw_palette2}
2486 @code{palette} can be an user defined lookup table.
2487 In this example, low values of @code{x} are colored
2488 in red, and higher values in yellow.
2490 @example
2491 (%i1) draw3d(
2492          palette = [red, blue, yellow],
2493          enhanced3d = x,
2494          explicit(x^2+y^2,x,-1,1,y,-1,1)) $
2495 @end example
2496 @figure{draw_palette3}
2498 See also @mref{colorbox} and @mrefdot{enhanced3d}
2500 @opencatbox
2501 @category{Package draw}
2502 @closecatbox
2504 @end defvr
2508 @anchor{point_size}
2509 @defvr {Graphic option} point_size
2510 Default value: 1
2512 @code{point_size} sets the size for plotted points. It must be a
2513 non negative number.
2515 This option has no effect when graphic option @code{point_type} is
2516 set to @code{dot}.
2518 This option affects the following graphic objects:
2519 @itemize @bullet
2520 @item
2521 @code{gr2d}: @mrefdot{points}
2523 @item
2524 @code{gr3d}: @mrefdot{points}
2525 @end itemize
2527 Example:
2529 @example
2530 (%i1) draw2d(points(makelist([random(20),random(50)],k,1,10)),
2531         point_size = 5,
2532         points(makelist(k,k,1,20),makelist(random(30),k,1,20)))$
2533 @end example
2534 @figure{draw_point_size}
2536 @opencatbox
2537 @category{Package draw}
2538 @closecatbox
2540 @end defvr
2544 @anchor{point_type_draw}
2545 @defvr {Graphic option} point_type
2546 Default value: 1
2548 @code{point_type} indicates how isolated points are displayed; the value of this
2549 option can be any integer index greater or equal than -1, or the name of
2550 a point style: @code{$none} (-1), @code{dot} (0), @code{plus} (1), @code{multiply} (2),
2551 @code{asterisk} (3), @code{square} (4), @code{filled_square} (5), @code{circle} (6),
2552 @code{filled_circle} (7), @code{up_triangle} (8), @code{filled_up_triangle} (9),
2553 @code{down_triangle} (10), @code{filled_down_triangle} (11), @code{diamant} (12) and
2554 @code{filled_diamant} (13).
2556 This option affects the following graphic objects:
2557 @itemize @bullet
2558 @item
2559 @code{gr2d}: @mrefdot{points}
2561 @item
2562 @code{gr3d}: @mrefdot{points}
2563 @end itemize
2565 Example:
2567 @example
2568 (%i1) draw2d(xrange = [0,10],
2569              yrange = [0,10],
2570              point_size = 3,
2571              point_type = diamant,
2572              points([[1,1],[5,1],[9,1]]),
2573              point_type = filled_down_triangle,
2574              points([[1,2],[5,2],[9,2]]),
2575              point_type = asterisk,
2576              points([[1,3],[5,3],[9,3]]),
2577              point_type = filled_diamant,
2578              points([[1,4],[5,4],[9,4]]),
2579              point_type = 5,
2580              points([[1,5],[5,5],[9,5]]),
2581              point_type = 6,
2582              points([[1,6],[5,6],[9,6]]),
2583              point_type = filled_circle,
2584              points([[1,7],[5,7],[9,7]]),
2585              point_type = 8,
2586              points([[1,8],[5,8],[9,8]]),
2587              point_type = filled_diamant,
2588              points([[1,9],[5,9],[9,9]]) )$
2589 @end example
2590 @figure{draw_point_type}
2592 @opencatbox
2593 @category{Package draw}
2594 @closecatbox
2596 @end defvr
2600 @anchor{points_joined}
2601 @defvr {Graphic option} points_joined
2602 Default value: @code{false}
2604 When @code{points_joined} is @code{true}, points are joined by lines; when @code{false},
2605 isolated points are drawn. A third possible value for this graphic option is 
2606 @code{impulses}; in such case, vertical segments are drawn from points to the x-axis (2D)
2607 or to the xy-plane (3D).
2609 This option affects the following graphic objects:
2610 @itemize @bullet
2611 @item
2612 @code{gr2d}: @mrefdot{points}
2614 @item
2615 @code{gr3d}: @mrefdot{points}
2616 @end itemize
2618 Example:
2620 @example
2621 (%i1) draw2d(xrange        = [0,10],
2622              yrange        = [0,4],
2623              point_size    = 3,
2624              point_type    = up_triangle,
2625              color         = blue,
2626              points([[1,1],[5,1],[9,1]]),
2627              points_joined = true,
2628              point_type    = square,
2629              line_type     = dots,
2630              points([[1,2],[5,2],[9,2]]),
2631              point_type    = circle,
2632              color         = red,
2633              line_width    = 7,
2634              points([[1,3],[5,3],[9,3]]) )$
2635 @end example
2636 @figure{draw_points_joined}
2638 @opencatbox
2639 @category{Package draw}
2640 @closecatbox
2642 @end defvr
2646 @anchor{proportional_axes}
2647 @defvr {Graphic option} proportional_axes
2648 Default value: @code{none}
2650 When @code{proportional_axes} is equal to @code{xy} or @code{xyz},
2651 the aspect ratio of the axis units will be set to 1:1 resulting in a 2D or 3D
2652 scene that will be drawn with axes proportional to their relative lengths.
2654 Since this is a global graphics option, its position in the scene description
2655 does not matter.
2657 This option works with Gnuplot version 4.2.6 or greater.
2659 Examples:
2661 Single 2D plot.
2663 @example
2664 (%i1) draw2d(
2665         ellipse(0,0,1,1,0,360),
2666         transparent=true,
2667         color = blue,
2668         line_width = 4,
2669         ellipse(0,0,2,1/2,0,360),
2670         proportional_axes = 'xy) $
2671 @end example
2672 @figure{draw_proportional_axis}
2674 Multiplot.
2676 @example
2677 (%i1) draw(
2678         terminal = wxt,
2679         gr2d(proportional_axes = 'xy,
2680              explicit(x^2,x,0,1)),
2681         gr2d(explicit(x^2,x,0,1),
2682              xrange = [0,1],
2683              yrange = [0,2],
2684              proportional_axes='xy),
2685         gr2d(explicit(x^2,x,0,1)))$
2686 @end example
2687 @figure{draw_proportional_axis2}
2689 @opencatbox
2690 @category{Package draw}
2691 @closecatbox
2693 @end defvr
2697 @anchor{surface_hide}
2698 @defvr {Graphic option} surface_hide
2699 Default value: @code{false}
2701 If @code{surface_hide} is @code{true}, hidden parts are not plotted in 3d surfaces.
2703 Since this is a global graphics option, its position in the scene description
2704 does not matter.
2706 Example:
2708 @example
2709 (%i1) draw(columns=2,
2710            gr3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)),
2711            gr3d(surface_hide = true,
2712                 explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3)) )$
2713 @end example
2714 @figure{draw_surface_hide}
2716 @opencatbox
2717 @category{Package draw}
2718 @closecatbox
2720 @end defvr
2724 @anchor{terminal}
2725 @defvr {Graphic option} terminal
2726 Default value: @code{screen}
2728 Selects the terminal to be used by Gnuplot; possible values are:
2729 @code{screen} (default), @code{png}, @code{pngcairo}, @code{jpg}, @code{gif}, 
2730 @code{eps}, @code{eps_color}, @code{epslatex}, @code{epslatex_standalone}, 
2731 @code{svg}, @code{canvas}, @code{dumb}, @code{dumb_file}, @code{pdf}, @code{pdfcairo}, 
2732 @code{wxt}, @code{animated_gif}, @code{multipage_pdfcairo}, @code{multipage_pdf}, 
2733 @code{multipage_eps}, @code{multipage_eps_color}, and @code{aquaterm}.
2735 Terminals @code{screen}, @code{wxt}, @code{windows} and @code{aquaterm} can
2736 be also defined as a list
2737 with two elements: the name of the terminal itself and a non negative integer number.
2738 In this form, multiple windows can be opened at the same time, each with its
2739 corresponding number. This feature does not work in Windows platforms.
2741 Since this is a global graphics option, its position in the scene description
2742 does not matter. It can be also used as an argument of function @code{draw}.
2744 N.B. pdfcairo requires Gnuplot 4.3 or newer. 
2745 @code{pdf} requires Gnuplot to be compiled with the option @code{--enable-pdf} and libpdf must
2746 be installed. The pdf library is available from: @url{http://www.pdflib.com/en/download/pdflib-family/pdflib-lite/}
2748 Examples:
2750 @example
2751 (%i1) /* screen terminal (default) */
2752       draw2d(explicit(x^2,x,-1,1))$
2753 (%i2) /* png file */
2754       draw2d(terminal  = 'png,
2755              explicit(x^2,x,-1,1))$
2756 (%i3) /* jpg file */
2757       draw2d(terminal   = 'jpg,
2758              dimensions = [300,300],
2759              explicit(x^2,x,-1,1))$
2760 (%i4) /* eps file */
2761       draw2d(file_name = "myfile",
2762              explicit(x^2,x,-1,1),
2763              terminal  = 'eps)$
2764 (%i5) /* pdf file */
2765       draw2d(file_name = "mypdf",
2766              dimensions = 100*[12.0,8.0],
2767              explicit(x^2,x,-1,1),
2768              terminal  = 'pdf)$
2769 (%i6) /* wxwidgets window */
2770       draw2d(explicit(x^2,x,-1,1),
2771              terminal  = 'wxt)$
2772 @end example
2774 Multiple windows.
2775 @example
2776 (%i1) draw2d(explicit(x^5,x,-2,2), terminal=[screen, 3])$
2777 (%i2) draw2d(explicit(x^2,x,-2,2), terminal=[screen, 0])$
2778 @end example
2780 An animated gif file.
2781 @example
2782 (%i1) draw(
2783         delay     = 100,
2784         file_name = "zzz",
2785         terminal  = 'animated_gif,
2786         gr2d(explicit(x^2,x,-1,1)),
2787         gr2d(explicit(x^3,x,-1,1)),
2788         gr2d(explicit(x^4,x,-1,1)));
2789 End of animation sequence
2790 (%o1)          [gr2d(explicit), gr2d(explicit), gr2d(explicit)]
2791 @end example
2793 Option @code{delay} is only active in animated gif's; it is ignored in
2794 any other case.
2796 Multipage output in eps format.
2797 @example
2798 (%i1) draw(
2799         file_name = "parabol",
2800         terminal  = multipage_eps,
2801         dimensions = 100*[10,10],
2802         gr2d(explicit(x^2,x,-1,1)),
2803         gr3d(explicit(x^2+y^2,x,-1,1,y,-1,1))) $
2804 @end example
2806 See also @mrefcomma{file_name}  @mref{dimensions_draw} and @mrefdot{delay}
2808 @opencatbox
2809 @category{Package draw}
2810 @closecatbox
2812 @end defvr
2816 @anchor{title_draw}
2817 @defvr {Graphic option} title
2818 Default value: @code{""} (empty string)
2820 Option @code{title}, a string, is the main title for the scene.
2821 By default, no title is written.
2823 Since this is a global graphics option, its position in the scene description
2824 does not matter.
2826 Example:
2828 @example
2829 (%i1) draw2d(explicit(exp(u),u,-2,2),
2830              title = "Exponential function")$
2831 @end example
2832 @figure{draw_title}
2834 @opencatbox
2835 @category{Package draw}
2836 @closecatbox
2838 @end defvr
2842 @anchor{transform}
2843 @defvr {Graphic option} transform
2844 Default value: @code{none}
2846 If @code{transform} is @code{none}, the space is not transformed and
2847 graphic objects are drawn as defined. When a space transformation is
2848 desired, a list must be assigned to option @code{transform}. In case of
2849 a 2D scene, the list takes the form @code{[f1(x,y), f2(x,y), x, y]}.
2850 In case of a 3D scene, the list is of the form
2851 @code{[f1(x,y,z), f2(x,y,z), f3(x,y,z), x, y, z]}.
2853 The names of the variables defined in the lists may be different to those
2854 used in the definitions of the graphic objects.
2856 Examples:
2858 Rotation in 2D.
2860 @example
2861 (%i1) th : %pi / 4$
2862 (%i2) draw2d(
2863         color = "#e245f0",
2864         proportional_axes = 'xy,
2865         line_width = 8,
2866         triangle([3,2],[7,2],[5,5]),
2867         border     = false,
2868         fill_color = yellow,
2869         transform  = [cos(th)*x - sin(th)*y,
2870                       sin(th)*x + cos(th)*y, x, y],
2871         triangle([3,2],[7,2],[5,5]) )$
2872 @end example
2873 @figure{draw_transform}
2875 Translation in 3D.
2877 @example
2878 (%i1) draw3d(
2879         color     = "#a02c00",
2880         explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3),
2881         transform = [x+10,y+10,z+10,x,y,z],
2882         color     = blue,
2883         explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3) )$
2884 @end example
2886 @opencatbox
2887 @category{Package draw}
2888 @closecatbox
2889 @end defvr
2893 @anchor{transparent}
2894 @defvr {Graphic option} transparent
2895 Default value: @code{false}
2897 If @code{transparent} is @code{false}, interior regions of polygons are 
2898 filled according to @code{fill_color}.
2900 This option affects the following graphic objects:
2901 @itemize @bullet
2902 @item
2903 @code{gr2d}: @mrefcomma{polygon} @mref{rectangle} and @mrefdot{ellipse}
2904 @end itemize
2906 Example:
2908 @example
2909 (%i1) draw2d(polygon([[3,2],[7,2],[5,5]]),
2910              transparent = true,
2911              color       = blue,
2912              polygon([[5,2],[9,2],[7,5]]) )$
2913 @end example
2914 @figure{draw_transparent}
2916 @opencatbox
2917 @category{Package draw}
2918 @closecatbox
2920 @end defvr
2924 @anchor{unit_vectors}
2925 @defvr {Graphic option} unit_vectors
2926 Default value: @code{false}
2928 If @code{unit_vectors} is @code{true}, vectors are plotted with module 1.
2929 This is useful for plotting vector fields. If @code{unit_vectors} is @code{false},
2930 vectors are plotted with its original length.
2932 This option is relevant only for @code{vector} objects.
2934 Example:
2936 @example
2937 (%i1) draw2d(xrange      = [-1,6],
2938              yrange      = [-1,6],
2939              head_length = 0.1,
2940              vector([0,0],[5,2]),
2941              unit_vectors = true,
2942              color        = red,
2943              vector([0,3],[5,2]))$
2944 @end example
2945 @figure{draw_unit_vectors}
2947 @opencatbox
2948 @category{Package draw}
2949 @closecatbox
2951 @end defvr
2955 @anchor{user_preamble}
2956 @defvr {Graphic option} user_preamble
2957 Default value: @code{""} (empty string)
2959 Expert Gnuplot users can make use of this option to fine tune Gnuplot's
2960 behaviour by writing settings to be sent before the @code{plot} or @code{splot}
2961 command.
2963 The value of this option must be a string or a list of strings (one per line).
2965 Since this is a global graphics option, its position in the scene description
2966 does not matter.
2968 Example:
2970 Tell Gnuplot to draw axes and grid on top of graphics objects,
2971 @example
2972 (%i1) draw2d(
2973         xaxis =true, xaxis_type=solid,
2974         yaxis =true, yaxis_type=solid,
2975         user_preamble="set grid front",
2976         region(x^2+y^2<1 ,x,-1.5,1.5,y,-1.5,1.5))$
2977 @end example
2978 @figure{draw_user_preamble}
2980 Tell gnuplot to draw all contour lines in black
2982 @example
2983 (%i1) draw3d(
2984           contour=both,
2985           surface_hide=true,enhanced3d=true,wired_surface=true,
2986           contour_levels=10,
2987           user_preamble="set for [i=1:8] linetype i dashtype i linecolor 0",
2988           explicit(sin(x)*cos(y),x,1,10,y,1,10)
2989       );
2990 @end example
2991 @figure{draw_user_preamble2}
2993 @opencatbox
2994 @category{Package draw}
2995 @closecatbox
2997 @end defvr
3002 @anchor{view}
3003 @defvr {Graphic option} view
3004 Default value: @code{[60,30]}
3006 A pair of angles, measured in degrees, indicating the view direction in a 
3007 3D scene. The first angle is the vertical rotation around the @var{x} axis, in 
3008 the range @math{[0, 360]}. The second one is the horizontal rotation around
3009 the @var{z} axis, in the range @math{[0, 360]}.
3011 If option @code{view} is given the value @code{map}, the view direction is set
3012 to be perpendicular to the xy-plane.
3014 Since this is a global graphics option, its position in the scene description
3015 does not matter.
3017 Example:
3019 @example
3020 (%i1) draw3d(view = [170, 50],
3021              enhanced3d = true,
3022              explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
3023 @end example
3024 @figure{draw_view}
3025 @example
3026 (%i2) draw3d(view = map,
3027              enhanced3d = true,
3028              explicit(sin(x^2+y^2),x,-2,2,y,-2,2) )$
3029 @end example
3030 @figure{draw_view2}
3032 @opencatbox
3033 @category{Package draw}
3034 @closecatbox
3036 @end defvr
3041 @anchor{wired_surface}
3042 @defvr {Graphic option} wired_surface
3043 Default value: @code{false}
3045 Indicates whether 3D surfaces in @code{enhanced3d} mode show the grid joinning
3046 the points or not.
3048 Since this is a global graphics option, its position in the scene description
3049 does not matter.
3051 Example:
3053 @example
3054 (%i1) draw3d(
3055         enhanced3d    = [sin(x),x,y],
3056         wired_surface = true,
3057         explicit(x^2+y^2,x,-1,1,y,-1,1)) $
3058 @end example
3059 @figure{draw_wired_surface}
3061 @opencatbox
3062 @category{Package draw}
3063 @closecatbox
3065 @end defvr
3070 @anchor{x_voxel}
3071 @defvr {Graphic option} x_voxel
3072 Default value: 10
3074 @code{x_voxel} is the number of voxels in the x direction to
3075 be used by the @i{marching cubes algorithm} implemented
3076 by the 3d @code{implicit} object. It is also used by graphic
3077 object @mrefdot{region}
3079 @opencatbox
3080 @category{Package draw}
3081 @closecatbox
3083 @end defvr
3088 @anchor{xaxis}
3089 @defvr {Graphic option} xaxis
3090 Default value: @code{false}
3092 If @code{xaxis} is @code{true}, the @var{x} axis is drawn.
3094 Since this is a global graphics option, its position in the scene description
3095 does not matter.
3097 Example:
3099 @example
3100 (%i1) draw2d(explicit(x^3,x,-1,1),
3101              xaxis       = true,
3102              xaxis_color = blue)$
3103 @end example
3104 @figure{draw_xaxis}
3106 See also @mrefcomma{xaxis_width}  @mref{xaxis_type} and @mrefdot{xaxis_color}
3108 @opencatbox
3109 @category{Package draw}
3110 @closecatbox
3112 @end defvr
3117 @anchor{xaxis_color}
3118 @defvr {Graphic option} xaxis_color
3119 Default value: @code{"black"}
3121 @code{xaxis_color} specifies the color for the @var{x} axis. See
3122 @code{color} to know how colors are defined.
3124 Since this is a global graphics option, its position in the scene description
3125 does not matter.
3127 Example:
3129 @example
3130 (%i1) draw2d(explicit(x^3,x,-1,1),
3131              xaxis       = true,
3132              xaxis_color = red)$
3133 @end example
3135 See also @mrefcomma{xaxis}  @mref{xaxis_width} and @mrefdot{xaxis_type}
3137 @opencatbox
3138 @category{Package draw}
3139 @closecatbox
3141 @end defvr
3145 @anchor{xaxis_secondary}
3146 @defvr {Graphic option} xaxis_secondary
3147 Default value: @code{false}
3149 If @code{xaxis_secondary} is @code{true}, function values can be plotted with 
3150 respect to the second @var{x} axis, which will be drawn on top of the scene.
3152 Note that this is a local graphics option which only affects to 2d plots.
3154 Example:
3156 @example
3157 (%i1) draw2d(
3158          key   = "Bottom x-axis",
3159          explicit(x+1,x,1,2),
3160          color = red,
3161          key   = "Above x-axis",
3162          xtics_secondary = true,
3163          xaxis_secondary = true,
3164          explicit(x^2,x,-1,1)) $
3165 @end example
3166 @figure{draw_xaxis_secondary}
3168 See also @mrefcomma{xrange_secondary}  @mrefcomma{xtics_secondary}  @mrefcomma{xtics_rotate_secondary} 
3169 @code{xtics_axis_secondary} and @mrefdot{xaxis_secondary}
3170 @c TODO: Document xtics_axis_secondary
3171 @opencatbox
3172 @category{Package draw}
3173 @closecatbox
3175 @end defvr
3180 @anchor{xaxis_type}
3181 @defvr {Graphic option} xaxis_type
3182 Default value: @code{dots}
3184 @code{xaxis_type} indicates how the @var{x} axis is displayed; 
3185 possible values are @code{solid} and @code{dots}
3187 Since this is a global graphics option, its position in the scene description
3188 does not matter.
3190 Example:
3192 @example
3193 (%i1) draw2d(explicit(x^3,x,-1,1),
3194              xaxis       = true,
3195              xaxis_type  = solid)$
3196 @end example
3198 See also @mrefcomma{xaxis}  @mref{xaxis_width} and @mrefdot{xaxis_color}
3200 @opencatbox
3201 @category{Package draw}
3202 @closecatbox
3204 @end defvr
3208 @anchor{xaxis_width}
3209 @defvr {Graphic option} xaxis_width
3210 Default value: 1
3212 @code{xaxis_width} is the width of the @var{x} axis.
3213 Its value must be a positive number.
3215 Since this is a global graphics option, its position in the scene description
3216 does not matter.
3218 Example:
3220 @example
3221 (%i1) draw2d(explicit(x^3,x,-1,1),
3222              xaxis       = true,
3223              xaxis_width = 3)$
3224 @end example
3226 See also @mrefcomma{xaxis}  @mref{xaxis_type} and @mrefdot{xaxis_color}
3228 @opencatbox
3229 @category{Package draw}
3230 @closecatbox
3232 @end defvr
3236 @anchor{xlabel_draw}
3237 @defvr {Graphic option} xlabel
3238 Default value: @code{""}
3240 Option @code{xlabel}, a string, is the label for the @var{x} axis.
3241 By default, the axis is labeled with string @code{"x"}.
3243 Since this is a global graphics option, its position in the scene description
3244 does not matter.
3246 Example:
3248 @example
3249 (%i1) draw2d(xlabel = "Time",
3250              explicit(exp(u),u,-2,2),
3251              ylabel = "Population")$
3252 @end example
3254 See also @mrefcomma{xlabel_secondary}  @mrefcomma{ylabel}  @mref{ylabel_secondary} and @mrefdot{zlabel_draw}
3256 @opencatbox
3257 @category{Package draw}
3258 @closecatbox
3260 @end defvr
3264 @anchor{xlabel_secondary}
3265 @defvr {Graphic option} xlabel_secondary
3266 Default value: @code{""} (empty string)
3268 Option @code{xlabel_secondary}, a string, is the label for the secondary @var{x} axis.
3269 By default, no label is written.
3271 Since this is a global graphics option, its position in the scene description
3272 does not matter.
3274 Example:
3276 @example
3277 (%i1) draw2d(
3278          xaxis_secondary=true,yaxis_secondary=true,
3279          xtics_secondary=true,ytics_secondary=true,
3280          xlabel_secondary="t[s]",
3281          ylabel_secondary="U[V]",
3282          explicit(sin(t),t,0,10) )$
3283 @end example
3284 @figure{draw_ylabel_secondary}
3286 See also @mrefcomma{xlabel_draw}  @mrefcomma{ylabel_draw}  @mref{ylabel_secondary} and @mrefdot{zlabel_draw}
3288 @opencatbox
3289 @category{Package draw}
3290 @closecatbox
3292 @end defvr
3296 @anchor{xrange}
3297 @defvr {Graphic option} xrange
3298 Default value: @code{auto}
3300 If @code{xrange} is @code{auto}, the range for the @var{x} coordinate is
3301 computed automatically.
3303 If the user wants a specific interval for @var{x}, it must be given as a 
3304 Maxima list, as in @code{xrange=[-2, 3]}.
3306 Since this is a global graphics option, its position in the scene description
3307 does not matter.
3309 Example:
3311 @example
3312 (%i1) draw2d(xrange = [-3,5],
3313              explicit(x^2,x,-1,1))$
3314 @end example
3316 See also @mref{yrange} and @mrefdot{zrange}
3318 @opencatbox
3319 @category{Package draw}
3320 @closecatbox
3322 @end defvr
3326 @anchor{xrange_secondary}
3327 @defvr {Graphic option} xrange_secondary
3328 Default value: @code{auto}
3330 If @code{xrange_secondary} is @code{auto}, the range for the second @var{x} axis is
3331 computed automatically.
3333 If the user wants a specific interval for the second @var{x} axis, it must be given as a 
3334 Maxima list, as in @code{xrange_secondary=[-2, 3]}.
3336 Since this is a global graphics option, its position in the scene description
3337 does not matter.
3339 See also @mrefcomma{xrange}  @mrefcomma{yrange}  @mref{zrange} and @mrefdot{yrange_secondary}
3341 @opencatbox
3342 @category{Package draw}
3343 @closecatbox
3344 @end defvr
3349 @anchor{xtics_draw}
3350 @defvr {Graphic option} xtics
3351 Default value: @code{true}
3353 This graphic option controls the way tic marks are drawn on the @var{x} axis.
3355 @itemize @bullet
3356 @item
3357 When option @code{xtics} is bounded to symbol @var{true}, tic marks are
3358 drawn automatically.
3360 @item
3361 When option @code{xtics} is bounded to symbol @var{false}, tic marks are
3362 not drawn.
3364 @item
3365 When option @code{xtics} is bounded to a positive number, this is the distance
3366 between two consecutive tic marks.
3368 @item
3369 When option @code{xtics} is bounded to a list of length three of the
3370 form @code{[start,incr,end]}, tic marks are plotted from @code{start} 
3371 to @code{end} at intervals of length @code{incr}.
3373 @item
3374 When option @code{xtics} is bounded to a set of numbers of the
3375 form @code{@{n1, n2, ...@}}, tic marks are plotted at values @code{n1},
3376 @code{n2}, ...
3378 @item
3379 When option @code{xtics} is bounded to a set of pairs of the
3380 form @code{@{["label1", n1], ["label2", n2], ...@}}, tic marks corresponding to values @code{n1},
3381 @code{n2}, ... are labeled with @code{"label1"}, @code{"label2"}, ..., respectively.
3382 @end itemize
3384 Since this is a global graphics option, its position in the scene description
3385 does not matter.
3387 Examples:
3389 Disable tics.
3390 @example
3391 (%i1) draw2d(xtics = 'false,
3392              explicit(x^3,x,-1,1)  )$
3393 @end example
3395 Tics every 1/4 units.
3396 @example
3397 (%i1) draw2d(xtics = 1/4,
3398              explicit(x^3,x,-1,1)  )$
3399 @end example
3401 Tics from -3/4 to 3/4 in steps of 1/8.
3402 @example
3403 (%i1) draw2d(xtics = [-3/4,1/8,3/4],
3404              explicit(x^3,x,-1,1)  )$
3405 @end example
3407 Tics at points -1/2, -1/4 and 3/4.
3408 @example
3409 (%i1) draw2d(xtics = @{-1/2,-1/4,3/4@},
3410              explicit(x^3,x,-1,1)  )$
3411 @end example
3413 Labeled tics.
3414 @example
3415 (%i1) draw2d(xtics = @{["High",0.75],["Medium",0],["Low",-0.75]@},
3416              explicit(x^3,x,-1,1)  )$
3417 @end example
3419 See also @mrefcomma{ytics}  and @mrefdot{ztics}
3421 @opencatbox
3422 @category{Package draw}
3423 @closecatbox
3425 @end defvr
3429 @anchor{xtics_axis}
3430 @defvr {Graphic option} xtics_axis
3431 Default value: @code{false}
3433 If @code{xtics_axis} is @code{true}, tic marks and their labels are plotted just
3434 along the @var{x} axis, if it is @code{false} tics are plotted on the border.
3436 Since this is a global graphics option, its position in the scene description
3437 does not matter.
3439 @opencatbox
3440 @category{Package draw}
3441 @closecatbox
3443 @end defvr
3447 @anchor{xtics_rotate}
3448 @defvr {Graphic option} xtics_rotate
3449 Default value: @code{false}
3451 If @code{xtics_rotate} is @code{true}, tic marks on the @var{x} axis are rotated 
3452 90 degrees.
3454 Since this is a global graphics option, its position in the scene description
3455 does not matter.
3457 @opencatbox
3458 @category{Package draw}
3459 @closecatbox
3461 @end defvr
3464 @anchor{xtics_rotate_secondary}
3465 @defvr {Graphic option} xtics_rotate_secondary
3466 Default value: @code{false}
3468 If @code{xtics_rotate_secondary} is @code{true}, tic marks on the secondary @var{x} axis are rotated 
3469 90 degrees.
3471 Since this is a global graphics option, its position in the scene description
3472 does not matter.
3474 @opencatbox
3475 @category{Package draw}
3476 @closecatbox
3478 @end defvr
3482 @anchor{xtics_secondary}
3483 @defvr {Graphic option} xtics_secondary
3484 Default value: @code{auto}
3486 This graphic option controls the way tic marks are drawn on the second @var{x} axis.
3488 See @code{xtics} for a complete description.
3490 @opencatbox
3491 @category{Package draw}
3492 @closecatbox
3494 @end defvr
3498 @anchor{xtics_secondary_axis}
3499 @defvr {Graphic option} xtics_secondary_axis
3500 Default value: @code{false}
3502 If @code{xtics_secondary_axis} is @code{true}, tic marks and their labels are plotted just
3503 along the secondary @var{x} axis, if it is @code{false} tics are plotted on the border.
3505 Since this is a global graphics option, its position in the scene description
3506 does not matter.
3508 @opencatbox
3509 @category{Package draw}
3510 @closecatbox
3512 @end defvr
3516 @anchor{xu_grid}
3517 @defvr {Graphic option} xu_grid
3518 Default value: 30
3520 @code{xu_grid} is the number of coordinates of the first variable
3521 (@code{x} in explicit and @code{u} in parametric 3d surfaces) to 
3522 build the grid of sample points.
3524 This option affects the following graphic objects:
3525 @itemize @bullet
3526 @item
3527 @code{gr3d}: @code{explicit} and @code{parametric_surface}.
3528 @end itemize
3530 Example:
3532 @example
3533 (%i1) draw3d(xu_grid = 10,
3534              yv_grid = 50,
3535              explicit(x^2+y^2,x,-3,3,y,-3,3) )$
3536 @end example
3538 See also @mrefdot{yv_grid}
3540 @opencatbox
3541 @category{Package draw}
3542 @closecatbox
3544 @end defvr
3549 @anchor{xy_file}
3550 @defvr {Graphic option} xy_file
3551 Default value: @code{""} (empty string)
3553 @code{xy_file} is the name of the file where the coordinates will be saved
3554 after clicking with the mouse button and hitting the 'x' key. By default,
3555 no coordinates are saved.
3557 Since this is a global graphics option, its position in the scene description
3558 does not matter.
3560 @opencatbox
3561 @category{Package draw}
3562 @closecatbox
3564 @end defvr
3569 @anchor{xyplane}
3570 @defvr {Graphic option} xyplane
3571 Default value: @code{false}
3573 Allocates the xy-plane in 3D scenes. When @code{xyplane} is
3574 @code{false}, the xy-plane is placed automatically; when it is
3575 a real number, the xy-plane intersects the z-axis at this level.
3576 This option has no effect in 2D scenes.
3578 Since this is a global graphics option, its position in the scene description
3579 does not matter.
3581 Example:
3583 @example
3584 (%i1) draw3d(xyplane = %e-2,
3585              explicit(x^2+y^2,x,-1,1,y,-1,1))$
3586 @end example
3588 @opencatbox
3589 @category{Package draw}
3590 @closecatbox
3592 @end defvr
3597 @anchor{y_voxel}
3598 @defvr {Graphic option} y_voxel
3599 Default value: 10
3601 @code{y_voxel} is the number of voxels in the y direction to
3602 be used by the @i{marching cubes algorithm} implemented
3603 by the 3d @code{implicit} object. It is also used by graphic
3604 object @mrefdot{region}
3606 @opencatbox
3607 @category{Package draw}
3608 @closecatbox
3610 @end defvr
3614 @anchor{yaxis}
3615 @defvr {Graphic option} yaxis
3616 Default value: @code{false}
3618 If @code{yaxis} is @code{true}, the @var{y} axis is drawn.
3620 Since this is a global graphics option, its position in the scene description
3621 does not matter.
3623 Example:
3625 @example
3626 (%i1) draw2d(explicit(x^3,x,-1,1),
3627              yaxis       = true,
3628              yaxis_color = blue)$
3629 @end example
3631 See also @mrefcomma{yaxis_width}  @mref{yaxis_type} and @mrefdot{yaxis_color}
3633 @opencatbox
3634 @category{Package draw}
3635 @closecatbox
3637 @end defvr
3641 @anchor{yaxis_color}
3642 @defvr {Graphic option} yaxis_color
3643 Default value: @code{"black"}
3645 @code{yaxis_color} specifies the color for the @var{y} axis. See
3646 @code{color} to know how colors are defined.
3648 Since this is a global graphics option, its position in the scene description
3649 does not matter.
3651 Example:
3653 @example
3654 (%i1) draw2d(explicit(x^3,x,-1,1),
3655              yaxis       = true,
3656              yaxis_color = red)$
3657 @end example
3659 See also @mrefcomma{yaxis}  @mref{yaxis_width} and @mrefdot{yaxis_type}
3661 @opencatbox
3662 @category{Package draw}
3663 @closecatbox
3665 @end defvr
3669 @anchor{yaxis_secondary}
3670 @defvr {Graphic option} yaxis_secondary
3671 Default value: @code{false}
3673 If @code{yaxis_secondary} is @code{true}, function values can be plotted with 
3674 respect to the second @var{y} axis, which will be drawn on the right side of the
3675 scene.
3677 Note that this is a local graphics option which only affects to 2d plots.
3679 Example:
3681 @example
3682 (%i1) draw2d(
3683          explicit(sin(x),x,0,10),
3684          yaxis_secondary = true,
3685          ytics_secondary = true,
3686          color = blue,
3687          explicit(100*sin(x+0.1)+2,x,0,10));
3688 @end example
3690 See also @mrefcomma{yrange_secondary}  @mrefcomma{ytics_secondary}  @mref{ytics_rotate_secondary}
3691 and @code{ytics_axis_secondary}
3692 @c TODO: Document ytics_axis_secondary
3694 @opencatbox
3695 @category{Package draw}
3696 @closecatbox
3698 @end defvr
3702 @anchor{yaxis_type}
3703 @defvr {Graphic option} yaxis_type
3704 Default value: @code{dots}
3706 @code{yaxis_type} indicates how the @var{y} axis is displayed; 
3707 possible values are @code{solid} and @code{dots}.
3709 Since this is a global graphics option, its position in the scene description
3710 does not matter.
3712 Example:
3714 @example
3715 (%i1) draw2d(explicit(x^3,x,-1,1),
3716              yaxis       = true,
3717              yaxis_type  = solid)$
3718 @end example
3720 See also @mrefcomma{yaxis}  @mref{yaxis_width} and @mrefdot{yaxis_color}
3722 @opencatbox
3723 @category{Package draw}
3724 @closecatbox
3726 @end defvr
3730 @anchor{yaxis_width}
3731 @defvr {Graphic option} yaxis_width
3732 Default value: 1
3734 @code{yaxis_width} is the width of the @var{y} axis.
3735 Its value must be a positive number.
3737 Since this is a global graphics option, its position in the scene description
3738 does not matter.
3740 Example:
3742 @example
3743 (%i1) draw2d(explicit(x^3,x,-1,1),
3744              yaxis       = true,
3745              yaxis_width = 3)$
3746 @end example
3748 See also @mrefcomma{yaxis}  @mref{yaxis_type} and @mrefdot{yaxis_color}
3750 @opencatbox
3751 @category{Package draw}
3752 @closecatbox
3754 @end defvr
3758 @anchor{ylabel_draw}
3759 @defvr {Graphic option} ylabel
3760 Default value: @code{""}
3762 Option @code{ylabel}, a string, is the label for the @var{y} axis.
3763 By default, the axis is labeled with string @code{"y"}.
3765 Since this is a global graphics option, its position in the scene description
3766 does not matter.
3768 Example:
3770 @example
3771 (%i1) draw2d(xlabel = "Time",
3772              ylabel = "Population",
3773              explicit(exp(u),u,-2,2) )$
3774 @end example
3776 See also @mrefcomma{xlabel_draw}  @mrefcomma{xlabel_secondary}  @mrefcomma{ylabel_secondary}  and @mrefdot{zlabel_draw}
3778 @opencatbox
3779 @category{Package draw}
3780 @closecatbox
3782 @end defvr
3786 @anchor{ylabel_secondary}
3787 @defvr {Graphic option} ylabel_secondary
3788 Default value: @code{""} (empty string)
3790 Option @code{ylabel_secondary}, a string, is the label for the secondary @var{y} axis.
3791 By default, no label is written.
3793 Since this is a global graphics option, its position in the scene description
3794 does not matter.
3796 Example:
3798 @example
3799 (%i1) draw2d(
3800         key_pos=bottom_right,
3801         key="current",
3802         xlabel="t[s]",
3803         ylabel="I[A]",ylabel_secondary="P[W]",
3804         explicit(sin(t),t,0,10),
3805         yaxis_secondary=true,
3806         ytics_secondary=true,
3807         color=red,key="Power",
3808         explicit((sin(t))^2,t,0,10)
3809     )$
3810 @end example
3812 See also @mrefcomma{xlabel_draw}  @mrefcomma{xlabel_secondary}  @mref{ylabel_draw} and @mrefdot{zlabel_draw}
3814 @opencatbox
3815 @category{Package draw}
3816 @closecatbox
3818 @end defvr
3822 @anchor{yrange}
3823 @defvr {Graphic option} yrange
3824 Default value: @code{auto}
3826 If @code{yrange} is @code{auto}, the range for the @var{y} coordinate is
3827 computed automatically.
3829 If the user wants a specific interval for @var{y}, it must be given as a 
3830 Maxima list, as in @code{yrange=[-2, 3]}.
3832 Since this is a global graphics option, its position in the scene description
3833 does not matter.
3835 Example:
3837 @example
3838 (%i1) draw2d(yrange = [-2,3],
3839              explicit(x^2,x,-1,1),
3840              xrange = [-3,3])$
3841 @end example
3843 See also @mrefcomma{xrange}  @mref{yrange_secondary} and @mrefdot{zrange}
3845 @opencatbox
3846 @category{Package draw}
3847 @closecatbox
3849 @end defvr
3853 @anchor{yrange_secondary}
3854 @defvr {Graphic option} yrange_secondary
3855 Default value: @code{auto}
3857 If @code{yrange_secondary} is @code{auto}, the range for the second @var{y} axis is
3858 computed automatically.
3860 If the user wants a specific interval for the second @var{y} axis, it must be given as a 
3861 Maxima list, as in @code{yrange_secondary=[-2, 3]}.
3863 Since this is a global graphics option, its position in the scene description
3864 does not matter.
3866 Example:
3868 @example
3869 (%i1) draw2d(
3870          explicit(sin(x),x,0,10),
3871          yaxis_secondary = true,
3872          ytics_secondary = true,
3873          yrange = [-3, 3],
3874          yrange_secondary = [-20, 20],
3875          color = blue,
3876          explicit(100*sin(x+0.1)+2,x,0,10)) $
3877 @end example
3879 See also @mrefcomma{xrange}  @mref{yrange} and @mrefdot{zrange}
3881 @opencatbox
3882 @category{Package draw}
3883 @closecatbox
3884 @end defvr
3888 @anchor{ytics_draw}
3889 @defvr {Graphic option} ytics
3890 Default value: @code{true}
3892 This graphic option controls the way tic marks are drawn on the @var{y} axis.
3894 See @code{xtics} for a complete description.
3896 @opencatbox
3897 @category{Package draw}
3898 @closecatbox
3900 @end defvr
3904 @anchor{ytics_axis}
3905 @defvr {Graphic option} ytics_axis
3906 Default value: @code{false}
3908 If @code{ytics_axis} is @code{true}, tic marks and their labels are plotted just
3909 along the @var{y} axis, if it is @code{false} tics are plotted on the border.
3911 Since this is a global graphics option, its position in the scene description
3912 does not matter.
3914 @opencatbox
3915 @category{Package draw}
3916 @closecatbox
3918 @end defvr
3923 @anchor{ytics_rotate}
3924 @defvr {Graphic option} ytics_rotate
3925 Default value: @code{false}
3927 If @code{ytics_rotate} is @code{true}, tic marks on the @var{y} axis are rotated 
3928 90 degrees.
3930 Since this is a global graphics option, its position in the scene description
3931 does not matter.
3933 @opencatbox
3934 @category{Package draw}
3935 @closecatbox
3937 @end defvr
3941 @anchor{ytics_rotate_secondary}
3942 @defvr {Graphic option} ytics_rotate_secondary
3943 Default value: @code{false}
3945 If @code{ytics_rotate_secondary} is @code{true}, tic marks on the secondary @var{y} axis are rotated 
3946 90 degrees.
3948 Since this is a global graphics option, its position in the scene description
3949 does not matter.
3951 @opencatbox
3952 @category{Package draw}
3953 @closecatbox
3955 @end defvr
3959 @anchor{ytics_secondary}
3960 @defvr {Graphic option} ytics_secondary
3961 Default value: @code{auto}
3963 This graphic option controls the way tic marks are drawn on the second @var{y} axis.
3965 See @code{xtics} for a complete description.
3967 @opencatbox
3968 @category{Package draw}
3969 @closecatbox
3971 @end defvr
3975 @anchor{ytics_secondary_axis}
3976 @defvr {Graphic option} ytics_secondary_axis
3977 Default value: @code{false}
3979 If @code{ytics_secondary_axis} is @code{true}, tic marks and their labels are plotted just
3980 along the secondary @var{y} axis, if it is @code{false} tics are plotted on the border.
3982 Since this is a global graphics option, its position in the scene description
3983 does not matter.
3985 @opencatbox
3986 @category{Package draw}
3987 @closecatbox
3989 @end defvr
3993 @anchor{yv_grid}
3994 @defvr {Graphic option} yv_grid
3995 Default value: 30
3997 @code{yv_grid} is the number of coordinates of the second variable
3998 (@code{y} in explicit and @code{v} in parametric 3d surfaces) to 
3999 build the grid of sample points.
4001 This option affects the following graphic objects:
4002 @itemize @bullet
4003 @item
4004 @code{gr3d}: @mref{explicit} and @mref{parametric_surface}.
4005 @end itemize
4007 Example:
4009 @example
4010 (%i1) draw3d(xu_grid = 10,
4011              yv_grid = 50,
4012              explicit(x^2+y^2,x,-3,3,y,-3,3) )$
4013 @end example
4014 @figure{draw_xugrid}
4016 See also @mrefdot{xu_grid}
4018 @opencatbox
4019 @category{Package draw}
4020 @closecatbox
4022 @end defvr
4025 @anchor{z_voxel}
4026 @defvr {Graphic option} z_voxel
4027 Default value: 10
4029 @code{z_voxel} is the number of voxels in the z direction to
4030 be used by the @i{marching cubes algorithm} implemented
4031 by the 3d @code{implicit} object.
4033 @opencatbox
4034 @category{Package draw}
4035 @closecatbox
4037 @end defvr
4040 @anchor{zaxis}
4041 @defvr {Graphic option} zaxis
4042 Default value: @code{false}
4044 If @code{zaxis} is @code{true}, the @var{z} axis is drawn in 3D plots.
4045 This option has no effect in 2D scenes.
4047 Since this is a global graphics option, its position in the scene description
4048 does not matter.
4050 Example:
4052 @example
4053 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4054              zaxis       = true,
4055              zaxis_type  = solid,
4056              zaxis_color = blue)$
4057 @end example
4059 See also @mrefcomma{zaxis_width}  @mref{zaxis_type} and @mrefdot{zaxis_color}
4061 @opencatbox
4062 @category{Package draw}
4063 @closecatbox
4065 @end defvr
4069 @anchor{zaxis_color}
4070 @defvr {Graphic option} zaxis_color
4071 Default value: @code{"black"}
4073 @code{zaxis_color} specifies the color for the @var{z} axis. See
4074 @code{color} to know how colors are defined. 
4075 This option has no effect in 2D scenes.
4077 Since this is a global graphics option, its position in the scene description
4078 does not matter.
4080 Example:
4082 @example
4083 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4084              zaxis       = true,
4085              zaxis_type  = solid,
4086              zaxis_color = red)$
4087 @end example
4089 See also @mrefcomma{zaxis}  @mref{zaxis_width} and @mrefdot{zaxis_type}
4091 @opencatbox
4092 @category{Package draw}
4093 @closecatbox
4095 @end defvr
4099 @anchor{zaxis_type}
4100 @defvr {Graphic option} zaxis_type
4101 Default value: @code{dots}
4103 @code{zaxis_type} indicates how the @var{z} axis is displayed; 
4104 possible values are @code{solid} and @code{dots}.
4105 This option has no effect in 2D scenes.
4107 Since this is a global graphics option, its position in the scene description
4108 does not matter.
4110 Example:
4112 @example
4113 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4114              zaxis       = true,
4115              zaxis_type  = solid)$
4116 @end example
4118 See also @mrefcomma{zaxis}  @mref{zaxis_width} and @mrefdot{zaxis_color}
4120 @opencatbox
4121 @category{Package draw}
4122 @closecatbox
4124 @end defvr
4129 @anchor{zaxis_width}
4130 @defvr {Graphic option} zaxis_width
4131 Default value: 1
4133 @code{zaxis_width} is the width of the @var{z} axis.
4134 Its value must be a positive number. This option has no effect in 2D scenes.
4136 Since this is a global graphics option, its position in the scene description
4137 does not matter.
4139 Example:
4141 @example
4142 (%i1) draw3d(explicit(x^2+y^2,x,-1,1,y,-1,1),
4143              zaxis       = true,
4144              zaxis_type  = solid,
4145              zaxis_width = 3)$
4146 @end example
4148 See also @mrefcomma{zaxis}  @mref{zaxis_type} and @mrefdot{zaxis_color}
4150 @opencatbox
4151 @category{Package draw}
4152 @closecatbox
4154 @end defvr
4158 @anchor{zlabel_draw}
4159 @defvr {Graphic option} zlabel
4160 Default value: @code{""}
4162 Option @code{zlabel}, a string, is the label for the @var{z} axis.
4163 By default, the axis is labeled with string @code{"z"}.
4165 Since this is a global graphics option, its position in the scene description
4166 does not matter.
4168 Example:
4170 @example
4171 (%i1) draw3d(zlabel = "Z variable",
4172              ylabel = "Y variable",
4173              explicit(sin(x^2+y^2),x,-2,2,y,-2,2),
4174              xlabel = "X variable" )$
4175 @end example
4177 See also @mrefcomma{xlabel_draw}  @mrefcomma{ylabel_draw}  and @mrefdot{zlabel_rotate}
4179 @opencatbox
4180 @category{Package draw}
4181 @closecatbox
4183 @end defvr
4188 @anchor{zlabel_rotate}
4189 @defvr {Graphic option} zlabel_rotate
4190 Default value: @code{"auto"}
4192 This graphics option allows to choose if the z axis label of 3d plots is
4193 drawn horizontal (@code{false}), vertical (@code{true}) or if maxima
4194 automatically chooses an orientation based on the length of the label
4195 (@code{auto}).
4197 Since this is a global graphics option, its position in the scene description
4198 does not matter.
4200 Example:
4202 @example
4203 (%i1) draw3d(
4204           explicit(sin(x)*sin(y),x,0,10,y,0,10),
4205           zlabel_rotate=false
4206       )$
4207 @end example
4209 See also @mrefdot{zlabel_draw}
4211 @opencatbox
4212 @category{Package draw}
4213 @closecatbox
4215 @end defvr
4220 @anchor{zrange}
4221 @defvr {Graphic option} zrange
4222 Default value: @code{auto}
4224 If @code{zrange} is @code{auto}, the range for the @var{z} coordinate is
4225 computed automatically.
4227 If the user wants a specific interval for @var{z}, it must be given as a 
4228 Maxima list, as in @code{zrange=[-2, 3]}.
4230 Since this is a global graphics option, its position in the scene description
4231 does not matter.
4233 Example:
4235 @example
4236 (%i1) draw3d(yrange = [-3,3],
4237              zrange = [-2,5],
4238              explicit(x^2+y^2,x,-1,1,y,-1,1),
4239              xrange = [-3,3])$
4240 @end example
4242 See also @mref{xrange} and @mrefdot{yrange}
4244 @opencatbox
4245 @category{Package draw}
4246 @closecatbox
4247 @end defvr
4250 @anchor{ztics}
4251 @defvr {Graphic option} ztics
4252 Default value: @code{true}
4254 This graphic option controls the way tic marks are drawn on the @var{z} axis.
4256 See @code{xtics} for a complete description.
4258 @opencatbox
4259 @category{Package draw}
4260 @closecatbox
4262 @end defvr
4267 @anchor{ztics_axis}
4268 @defvr {Graphic option} ztics_axis
4269 Default value: @code{false}
4271 If @code{ztics_axis} is @code{true}, tic marks and their labels are plotted just
4272 along the @var{z} axis, if it is @code{false} tics are plotted on the border.
4274 Since this is a global graphics option, its position in the scene description
4275 does not matter.
4277 @opencatbox
4278 @category{Package draw}
4279 @closecatbox
4281 @end defvr
4284 @anchor{ztics_rotate}
4285 @defvr {Graphic option} ztics_rotate
4286 Default value: @code{false}
4288 If @code{ztics_rotate} is @code{true}, tic marks on the @var{z} axis are rotated 
4289 90 degrees.
4291 Since this is a global graphics option, its position in the scene description
4292 does not matter.
4294 @opencatbox
4295 @category{Package draw}
4296 @closecatbox
4298 @end defvr
4303 @subsection Graphics objects
4307 @anchor{bars}
4308 @deffn  {Graphic object} bars ([@var{x1},@var{h1},@var{w1}], [@var{x2},@var{h2},@var{w2}, ...])
4309 Draws vertical bars in 2D.
4311 @b{2D}
4313 @code{bars ([@var{x1},@var{h1},@var{w1}], [@var{x2},@var{h2},@var{w2}, ...])} 
4314 draws bars centered at values @var{x1}, @var{x2}, ... with heights @var{h1}, @var{h2}, ...
4315 and widths @var{w1}, @var{w2}, ...
4317 This object is affected by the following @i{graphic options}: @mrefcomma{key} 
4318 @mrefcomma{fill_color} @mref{fill_density} and @mrefdot{line_width}
4320 Example:
4322 @example
4323 (%i1) draw2d(
4324        key          = "Group A",
4325        fill_color   = blue,
4326        fill_density = 0.2,
4327        bars([0.8,5,0.4],[1.8,7,0.4],[2.8,-4,0.4]),
4328        key          = "Group B",
4329        fill_color   = red,
4330        fill_density = 0.6,
4331        line_width   = 4,
4332        bars([1.2,4,0.4],[2.2,-2,0.4],[3.2,5,0.4]),
4333        xaxis = true);
4334 @end example
4335 @figure{draw_bars}
4337 @opencatbox
4338 @category{Package draw}
4339 @closecatbox
4341 @end deffn
4345 @anchor{cylindrical}
4346 @deffn  {Graphic object} cylindrical (@var{radius}, @var{z}, @var{minz}, @var{maxz}, @var{azi}, @var{minazi}, @var{maxazi})
4347 Draws 3D functions defined in cylindrical coordinates.
4349 @b{3D}
4351 @code{cylindrical(@var{radius}, @var{z}, @var{minz}, @var{maxz}, @var{azi},
4352 @var{minazi}, @var{maxazi})} plots the function @code{@var{radius}(@var{z},
4353 @var{azi})} defined in cylindrical coordinates, with variable @var{z} taking
4354 values from @var{minz} to @var{maxz} and @i{azimuth} @var{azi} taking values
4355 from @var{minazi} to @var{maxazi}.
4357 This object is affected by the following @i{graphic options}: @mrefcomma{xu_grid} 
4358 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{key} @mrefcomma{wired_surface} @code{enhanced3d} and @code{color}
4360 Example:
4362 @example
4363 (%i1) draw3d(cylindrical(1,z,-2,2,az,0,2*%pi))$
4364 @end example
4365 @figure{draw_cylindrical}
4367 @opencatbox
4368 @category{Package draw}
4369 @closecatbox
4371 @end deffn
4376 @anchor{elevation_grid}
4377 @deffn  {Graphic object} elevation_grid (@var{mat},@var{x0},@var{y0},@var{width},@var{height})
4378 Draws matrix @var{mat} in 3D space. @var{z} values are taken from @var{mat},
4379 the abscissas range from @var{x0} to @math{@var{x0} + @var{width}}
4380 and ordinates from @var{y0} to @math{@var{y0} + @var{height}}. Element @math{a(1,1)}
4381 is projected on point @math{(x0,y0+height)}, @math{a(1,n)} on @math{(x0+width,y0+height)},
4382 @math{a(m,1)} on @math{(x0,y0)}, and @math{a(m,n)} on @math{(x0+width,y0)}.
4384 This object is affected by the following @i{graphic options}: @mrefcomma{line_type},
4385 @mref{line_width}  @mrefcomma{key}  @mrefcomma{wired_surface}  @mref{enhanced3d} and @code{color}
4387 In older versions of Maxima, @mref{elevation_grid} was called @mrefdot{mesh}
4388 See also @mrefdot{mesh}
4390 Example:
4392 @example
4393 (%i1) m: apply(
4394             matrix,
4395             makelist(makelist(random(10.0),k,1,30),i,1,20)) $
4396 (%i2) draw3d(
4397          color = blue,
4398          elevation_grid(m,0,0,3,2),
4399          xlabel = "x",
4400          ylabel = "y",
4401          surface_hide = true);
4402 @end example
4403 @figure{draw_elevation_grid}
4405 @opencatbox
4406 @category{Package draw}
4407 @closecatbox
4409 @end deffn
4414 @anchor{ellipse}
4415 @deffn  {Graphic object} ellipse (@var{xc}, @var{yc}, @var{a}, @var{b}, @var{ang1}, @var{ang2})
4416 Draws ellipses and circles in 2D.
4419 @b{2D}
4421 @code{ellipse (@var{xc}, @var{yc}, @var{a}, @var{b}, @var{ang1}, @var{ang2})}
4422 plots an ellipse centered at @code{[@var{xc}, @var{yc}]} with horizontal and vertical
4423 semi axis @var{a} and @var{b}, respectively, starting at angle @var{ang1} with an amplitude
4424 equal to angle @var{ang2}.
4426 This object is affected by the following @i{graphic options}: @mrefcomma{nticks} 
4427 @mrefcomma{transparent} @mrefcomma{fill_color} @mrefcomma{border} @code{line_width}, 
4428 @mrefcomma{line_type} @mref{key} and @code{color}
4430 Example:
4432 @example
4433 (%i1) draw2d(transparent = false,
4434              fill_color  = red,
4435              color       = gray30,
4436              transparent = false,
4437              line_width  = 5,
4438              ellipse(0,6,3,2,270,-270),
4439              /* center (x,y), a, b, start & end in degrees */
4440              transparent = true,
4441              color       = blue,
4442              line_width  = 3,
4443              ellipse(2.5,6,2,3,30,-90),
4444              xrange      = [-3,6],
4445              yrange      = [2,9] )$
4446 @end example
4447 @figure{draw_ellipse}
4449 @opencatbox
4450 @category{Package draw}
4451 @closecatbox
4453 @end deffn
4456 @anchor{errors}
4457 @deffn  {Graphic object} errors ([@var{x1}, @var{x2}, @dots{}], [@var{y1}, @var{y2}, @dots{}])
4458 Draws points with error bars, horizontally, vertically or both, depending on the
4459 value of option @code{error_type}.
4461 @b{2D}
4463 If @code{error_type = x}, arguments to @code{errors} must be of the form
4464 @code{[x, y, xdelta]} or @code{[x, y, xlow, xhigh]}.  If @code{error_type = y}, 
4465 arguments must be of the form @code{[x, y, ydelta]} or
4466 @code{[x, y, ylow, yhigh]}.  If @code{error_type = xy} or
4467 @code{error_type = boxes}, arguments to @code{errors} must be of the form
4468 @code{[x, y, xdelta, ydelta]} or @code{[x, y, xlow, xhigh, ylow, yhigh]}.
4470 See also @mrefdot{error_type}
4472 This object is affected by the following @i{graphic options}: @mrefcomma{error_type}  
4473 @mrefcomma{points_joined}  @mrefcomma{line_width}  @mrefcomma{key}  @mrefcomma{line_type}  
4474 @code{color}  @mrefcomma{fill_density}  @mref{xaxis_secondary}  and  @mrefdot{yaxis_secondary}
4476 Option @mref{fill_density} is only relevant when @code{error_type=boxes}.
4478 Examples:
4480 Horizontal error bars.
4482 @example
4483 (%i1) draw2d(
4484         error_type = 'y,
4485         errors([[1,2,1], [3,5,3], [10,3,1], [17,6,2]]))$
4486 @end example
4487 @figure{draw_errors}
4489 Vertical and horizontal error bars.
4491 @example
4492 (%i1) draw2d(
4493         error_type = 'xy,
4494         points_joined = true,
4495         color = blue,
4496         errors([[1,2,1,2], [3,5,2,1], [10,3,1,1], [17,6,1/2,2]])); 
4497 @end example
4498 @figure{draw_errors2}
4500 @opencatbox
4501 @category{Package draw}
4502 @closecatbox
4504 @end deffn
4507 @anchor{explicit}
4508 @deffn  {Graphic object} explicit @
4509 @fname{explicit} (@var{expr},@var{var},@var{minval},@var{maxval}) @
4510 @fname{explicit} (@var{fcn},@var{var},@var{minval},@var{maxval}) @
4511 @fname{explicit} (@var{expr},@var{var1},@var{minval1},@var{maxval1},@var{var2},@var{minval2},@var{maxval2}) @
4512 @fname{explicit} (@var{fcn},@var{var1},@var{minval1},@var{maxval1},@var{var2},@var{minval2},@var{maxval2})
4514 Draws explicit functions in 2D and 3D.
4516 @b{2D}
4518 @code{explicit(@var{fcn},@var{var},@var{minval},@var{maxval})} plots explicit function @var{fcn},
4519 with variable @var{var} taking values from @var{minval} to @var{maxval}.
4521 This object is affected by the following @i{graphic options}: @mrefcomma{nticks} 
4522 @code{adapt_depth}, @mrefcomma{draw_realpart} @mrefcomma{line_width} @mrefcomma{line_type} @mrefcomma{key} 
4523 @mrefcomma{filled_func} @mref{fill_color} and @code{color}
4525 Example:
4527 @example
4528 (%i1) draw2d(line_width = 3,
4529              color      = blue,
4530              explicit(x^2,x,-3,3) )$
4531 @end example
4532 @figure{draw_explicit}
4533 @example
4534 (%i2) draw2d(fill_color  = brown,
4535              filled_func = true,
4536              explicit(x^2,x,-3,3) )$
4537 @end example
4538 @figure{draw_explicit2}
4540 @b{3D}
4542 @code{explicit(@var{fcn}, @var{var1}, @var{minval1}, @var{maxval1}, @var{var2},
4543 @var{minval2}, @var{maxval2})} plots the explicit function @var{fcn}, with
4544 variable @var{var1} taking values from @var{minval1} to @var{maxval1} and
4545 variable @var{var2} taking values from @var{minval2} to @var{maxval2}.
4547 This object is affected by the following @i{graphic options}: @mrefcomma{draw_realpart} @mrefcomma{xu_grid}
4548 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{wired_surface}
4549 @mref{enhanced3d} and @code{color}.
4551 Example:
4553 @example
4554 (%i1) draw3d(key   = "Gauss",
4555              color = "#a02c00",
4556              explicit(20*exp(-x^2-y^2)-10,x,-3,3,y,-3,3),
4557              yv_grid     = 10,
4558              color = blue,
4559              key   = "Plane",
4560              explicit(x+y,x,-5,5,y,-5,5),
4561              surface_hide = true)$
4562 @end example
4563 @figure{draw_explicit3}
4565 See also @mref{filled_func} for filled functions.
4567 @opencatbox
4568 @category{Package draw}
4569 @closecatbox
4571 @end deffn
4575 @anchor{image}
4576 @deffn  {Graphic object} image (@var{im},@var{x0},@var{y0},@var{width},@var{height})
4577 Renders images in 2D.
4579 @b{2D}
4581 @code{image (@var{im},@var{x0},@var{y0},@var{width},@var{height})} plots image @var{im} in the rectangular
4582 region from vertex @code{(@var{x0},@var{y0})} to @code{(x0+@var{width},y0+@var{height})} on the real
4583 plane. Argument @var{im} must be a matrix of real numbers, a matrix of
4584 vectors of length three or a @var{picture} object.
4586 If @var{im} is a matrix of real numbers or a @var{levels picture} object,
4587 pixel values are interpreted according to graphic option @code{palette},
4588 which is a vector of length three with components 
4589 ranging from -36 to +36; each value is an index for a formula mapping the levels
4590 onto red, green and blue colors, respectively:
4591 @example
4592  0: 0               1: 0.5           2: 1
4593  3: x               4: x^2           5: x^3
4594  6: x^4             7: sqrt(x)       8: sqrt(sqrt(x))
4595  9: sin(90x)       10: cos(90x)     11: |x-0.5|
4596 12: (2x-1)^2       13: sin(180x)    14: |cos(180x)|
4597 15: sin(360x)      16: cos(360x)    17: |sin(360x)|
4598 18: |cos(360x)|    19: |sin(720x)|  20: |cos(720x)|
4599 21: 3x             22: 3x-1         23: 3x-2
4600 24: |3x-1|         25: |3x-2|       26: (3x-1)/2
4601 27: (3x-2)/2       28: |(3x-1)/2|   29: |(3x-2)/2|
4602 30: x/0.32-0.78125                  31: 2*x-0.84
4603 32: 4x;1;-2x+1.84;x/0.08-11.5
4604 33: |2*x - 0.5|    34: 2*x          35: 2*x - 0.5
4605 36: 2*x - 1
4606 @end example
4607 negative numbers mean negative colour component.
4609 @code{palette = gray} and @code{palette = color} are short cuts for
4610 @code{palette = [3,3,3]} and @code{palette = [7,5,15]}, respectively.
4612 If @var{im} is a matrix of vectors of length three or an @var{rgb picture} object,
4613 they are interpreted as red, green and blue color components.
4615 Examples:
4617 If @var{im} is a matrix of real numbers, pixel values are interpreted according
4618 to graphic option @code{palette}.
4619 @example
4620 (%i1) im: apply(
4621            'matrix,
4622             makelist(makelist(random(200),i,1,30),i,1,30))$
4623 (%i2) /* palette = color, default */
4624       draw2d(image(im,0,0,30,30))$
4625 @end example
4626 @figure{draw_image}
4627 @example
4628 (%i3) draw2d(palette = gray, image(im,0,0,30,30))$
4629 @end example
4630 @figure{draw_image2}
4631 @example
4632 (%i4) draw2d(palette = [15,20,-4],
4633              colorbox=false,
4634              image(im,0,0,30,30))$
4635 @end example
4636 @figure{draw_image3}
4638 See also @mrefdot{colorbox}
4640 If @var{im} is a matrix of vectors of length three, they are interpreted
4641 as red, green and blue color components.
4642 @example
4643 (%i1) im: apply(
4644             'matrix,
4645              makelist(
4646                makelist([random(300),
4647                          random(300),
4648                          random(300)],i,1,30),i,1,30))$
4649 (%i2) draw2d(image(im,0,0,30,30))$
4650 @end example
4651 @figure{draw_image4}
4653 Package @code{draw} automatically loads package @code{picture}. In this
4654 example, a level picture object is built by hand and then rendered.
4655 @example
4656 (%i1) im: make_level_picture([45,87,2,134,204,16],3,2);
4657 (%o1)       picture(level, 3, 2, @{Array:  #(45 87 2 134 204 16)@})
4658 (%i2) /* default color palette */
4659       draw2d(image(im,0,0,30,30))$
4660 @end example
4661 @figure{draw_image5}
4662 @example
4663 (%i3) /* gray palette */
4664       draw2d(palette = gray,
4665              image(im,0,0,30,30))$
4666 @end example
4667 @figure{draw_image6}
4669 An xpm file is read and then rendered.
4670 @example
4671 (%i1) im: read_xpm("myfile.xpm")$
4672 (%i2) draw2d(image(im,0,0,10,7))$
4673 @end example
4675 See also @mrefcomma{make_level_picture}  @mref{make_rgb_picture} and @mrefdot{read_xpm}
4677 @url{http://www.telefonica.net/web2/biomates/maxima/gpdraw/image}@*
4678 contains more elaborated examples.
4680 @opencatbox
4681 @category{Package draw}
4682 @closecatbox
4684 @end deffn
4689 @anchor{implicit}
4690 @deffn  {Graphic object} implicit @
4691 @fname{implicit} (@var{fcn},@var{x},@var{xmin},@var{xmax},@var{y},@var{ymin},@var{ymax}) @
4692 @fname{implicit} (@var{fcn},@var{x},@var{xmin},@var{xmax},@var{y},@var{ymin},@var{ymax},@var{z},@var{zmin},@var{zmax})
4694 Draws implicit functions in 2D and 3D.
4696 @b{2D}
4698 @code{implicit(@var{fcn},@var{x},@var{xmin},@var{xmax},@var{y},@var{ymin},@var{ymax})}
4699 plots the implicit function defined by @var{fcn}, with variable @var{x} taking values
4700 from @var{xmin} to @var{xmax}, and variable @var{y} taking values
4701 from @var{ymin} to @var{ymax}.
4703 This object is affected by the following @i{graphic options}: @mrefcomma{ip_grid} 
4704 @mrefcomma{ip_grid_in} @mrefcomma{line_width} @mrefcomma{line_type} @mref{key} and @code{color}.
4706 Example:
4708 @example
4709 (%i1) draw2d(grid      = true,
4710              line_type = solid,
4711              key       = "y^2=x^3-2*x+1",
4712              implicit(y^2=x^3-2*x+1, x, -4,4, y, -4,4),
4713              line_type = dots,
4714              key       = "x^3+y^3 = 3*x*y^2-x-1",
4715              implicit(x^3+y^3 = 3*x*y^2-x-1, x,-4,4, y,-4,4),
4716              title     = "Two implicit functions" )$
4717 @end example
4718 @figure{draw_implicit}
4720 @b{3D}
4722 @code{implicit (@var{fcn},@var{x},@var{xmin},@var{xmax}, @var{y},@var{ymin},@var{ymax}, @var{z},@var{zmin},@var{zmax})}
4723 plots the implicit surface defined by @var{fcn}, with variable @var{x} taking values
4724 from @var{xmin} to @var{xmax}, variable @var{y} taking values
4725 from @var{ymin} to @var{ymax} and variable @var{z} taking values
4726 from @var{zmin} to @var{zmax}. This object implements the @i{marching cubes algorithm}.
4728 This object is affected by the following @i{graphic options}: @mrefcomma{x_voxel} 
4729 @mrefcomma{y_voxel} @mrefcomma{z_voxel} @mrefcomma{line_width} @mrefcomma{line_type} @mrefcomma{key}
4730 @mrefcomma{wired_surface} @mref{enhanced3d} and @code{color}.
4732 Example:
4734 @example
4735 (%i1) draw3d(
4736         color=blue,
4737         implicit((x^2+y^2+z^2-1)*(x^2+(y-1.5)^2+z^2-0.5)=0.015,
4738                  x,-1,1,y,-1.2,2.3,z,-1,1),
4739         surface_hide=true);
4740 @end example
4741 @figure{draw_implicit2}
4743 @opencatbox
4744 @category{Package draw}
4745 @closecatbox
4746 @end deffn
4750 @anchor{label_draw}
4751 @deffn  {Graphic object} label @
4752 @fname{label} ([@var{string},@var{x},@var{y}],...) @
4753 @fname{label} ([@var{string},@var{x},@var{y},@var{z}],...)
4755 Writes labels in 2D and 3D.
4757 Colored labels work only with Gnuplot 4.3 and up.
4759 This object is affected by the following @i{graphic options}: @mrefcomma{label_alignment} 
4760 @mref{label_orientation} and @code{color}.
4762 @b{2D}
4764 @code{label([@var{string},@var{x},@var{y}])} writes the @var{string} at point
4765 @code{[@var{x},@var{y}]}.
4767 Example:
4769 @example
4770 (%i1) draw2d(yrange = [0.1,1.4],
4771              color = red,
4772              label(["Label in red",0,0.3]),
4773              color = "#0000ff",
4774              label(["Label in blue",0,0.6]),
4775              color = light_blue,
4776              label(["Label in light-blue",0,0.9],
4777                    ["Another light-blue",0,1.2])  )$
4778 @end example
4779 @figure{draw_label}
4781 @b{3D}
4783 @code{label([@var{string},@var{x},@var{y},@var{z}])} writes the @var{string} at point
4784 @code{[@var{x},@var{y},@var{z}]}.
4786 Example:
4788 @example
4789 (%i1) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3),
4790              color = red,
4791              label(["UP 1",-2,0,3], ["UP 2",1.5,0,4]),
4792              color = blue,
4793              label(["DOWN 1",2,0,-3]) )$
4794 @end example
4795 @figure{draw_label2}
4797 @opencatbox
4798 @category{Package draw}
4799 @closecatbox
4801 @end deffn
4804 @anchor{mesh}
4805 @deffn  {Graphic object} mesh (@var{row_1},@var{row_2},...)
4806 Draws a quadrangular mesh in 3D.
4808 @b{3D}
4810 Argument @var{row_i} is a list of @var{n} 3D points of the form
4811 @code{[[x_i1,y_i1,z_i1], ...,[x_in,y_in,z_in]]}, and all rows are
4812 of equal length. All these points define an arbitrary surface in 3D and
4813 in some sense it's a generalization of the @code{elevation_grid} object.
4815 This object is affected by the following @i{graphic options}: @mrefcomma{line_type} 
4816 @mrefcomma{line_width} @mrefcomma{color} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d} and @mrefdot{transform}
4818 Examples:
4820 A simple example.
4822 @example
4823 (%i1) draw3d( 
4824          mesh([[1,1,3],   [7,3,1],[12,-2,4],[15,0,5]],
4825               [[2,7,8],   [4,3,1],[10,5,8], [12,7,1]],
4826               [[-2,11,10],[6,9,5],[6,15,1], [20,15,2]])) $
4827 @end example
4828 @figure{draw_mesh}
4830 Plotting a triangle in 3D.
4832 @example
4833 (%i1) draw3d(
4834         line_width = 2,
4835         mesh([[1,0,0],[0,1,0]],
4836              [[0,0,1],[0,0,1]])) $
4837 @end example
4838 @figure{draw_mesh2}
4840 Two quadrilaterals.
4842 @example
4843 (%i1) draw3d(
4844         surface_hide = true,
4845         line_width   = 3,
4846         color = red,
4847         mesh([[0,0,0], [0,1,0]],
4848              [[2,0,2], [2,2,2]]),
4849         color = blue,
4850         mesh([[0,0,2], [0,1,2]],
4851              [[2,0,4], [2,2,4]])) $
4852 @end example
4853 @figure{draw_mesh3}
4855 @opencatbox
4856 @category{Package draw}
4857 @closecatbox
4859 @end deffn
4862 @anchor{parametric}
4863 @deffn  {Graphic object} parametric @
4864 @fname{parametric} (@var{xfun},@var{yfun},@var{par},@var{parmin},@var{parmax}) @
4865 @fname{parametric} (@var{xfun},@var{yfun},@var{zfun},@var{par},@var{parmin},@var{parmax})
4867 Draws parametric functions in 2D and 3D.
4869 This object is affected by the following @i{graphic options}: @mrefcomma{nticks} 
4870 @mrefcomma{line_width} @mrefcomma{line_type} @mrefcomma{key} @mref{color} and @mrefdot{enhanced3d}
4872 @b{2D}
4874 The command @code{parametric(@var{xfun}, @var{yfun}, @var{par}, @var{parmin},
4875 @var{parmax})} plots the parametric function @code{[@var{xfun}, @var{yfun}]},
4876 with parameter @var{par} taking values from @var{parmin} to @var{parmax}.
4878 Example:
4880 @example
4881 (%i1) draw2d(explicit(exp(x),x,-1,3),
4882              color = red,
4883              key   = "This is the parametric one!!",
4884              parametric(2*cos(rrr),rrr^2,rrr,0,2*%pi))$
4885 @end example
4886 @figure{draw_parametric}
4888 @b{3D}
4890 @code{parametric(@var{xfun}, @var{yfun}, @var{zfun}, @var{par}, @var{parmin},
4891 @var{parmax})} plots the parametric curve @code{[@var{xfun}, @var{yfun},
4892 @var{zfun}]}, with parameter @var{par} taking values from @var{parmin} to
4893 @var{parmax}.
4895 Example:
4897 @example
4898 (%i1) draw3d(explicit(exp(sin(x)+cos(x^2)),x,-3,3,y,-3,3),
4899              color = royalblue,
4900              parametric(cos(5*u)^2,sin(7*u),u-2,u,0,2),
4901              color      = turquoise,
4902              line_width = 2,
4903              parametric(t^2,sin(t),2+t,t,0,2),
4904              surface_hide = true,
4905              title = "Surface & curves" )$
4906 @end example
4907 @figure{draw_parametric2}
4909 @opencatbox
4910 @category{Package draw}
4911 @closecatbox
4913 @end deffn
4917 @anchor{parametric_surface}
4918 @deffn  {Graphic object} parametric_surface (@var{xfun}, @var{yfun}, @var{zfun}, @var{par1}, @var{par1min}, @var{par1max}, @var{par2}, @var{par2min}, @var{par2max})
4919 Draws parametric surfaces in 3D.
4921 @b{3D}
4923 The command @code{parametric_surface(@var{xfun}, @var{yfun}, @var{zfun},
4924 @var{par1}, @var{par1min}, @var{par1max}, @var{par2}, @var{par2min},
4925 @var{par2max})} plots the parametric surface @code{[@var{xfun}, @var{yfun},
4926 @var{zfun}]}, with parameter @var{par1} taking values from @var{par1min} to
4927 @var{par1max} and parameter @var{par2} taking values from @var{par2min} to
4928 @var{par2max}.
4930 This object is affected by the following @i{graphic options}: @mrefcomma{draw_realpart} @mrefcomma{xu_grid} 
4931 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d}
4932  and @code{color}.
4934 Example:
4936 @example
4937 (%i1) draw3d(title          = "Sea shell",
4938              xu_grid        = 100,
4939              yv_grid        = 25,
4940              view           = [100,20],
4941              surface_hide   = true,
4942              parametric_surface(0.5*u*cos(u)*(cos(v)+1),
4943                            0.5*u*sin(u)*(cos(v)+1),
4944                            u*sin(v) - ((u+3)/8*%pi)^2 - 20,
4945                            u, 0, 13*%pi, v, -%pi, %pi) )$
4946 @end example
4947 @figure{draw_parametric3}
4949 @opencatbox
4950 @category{Package draw}
4951 @closecatbox
4953 @end deffn
4957 @anchor{points}
4958 @deffn  {Graphic object} points @
4959 @fname{points} ([[@var{x1},@var{y1}], [@var{x2},@var{y2}],...]) @
4960 @fname{points} ([@var{x1},@var{x2},...], [@var{y1},@var{y2},...]) @
4961 @fname{points} ([@var{y1},@var{y2},...]) @
4962 @fname{points} ([[@var{x1},@var{y1},@var{z1}], [@var{x2},@var{y2},@var{z2}],...]) @
4963 @fname{points} ([@var{x1},@var{x2},...], [@var{y1},@var{y2},...], [@var{z1},@var{z2},...]) @
4964 @fname{points} (@var{matrix}) @
4965 @fname{points} (@var{1d_y_array}) @
4966 @fname{points} (@var{1d_x_array}, @var{1d_y_array}) @
4967 @fname{points} (@var{1d_x_array}, @var{1d_y_array}, @var{1d_z_array}) @
4968 @fname{points} (@var{2d_xy_array}) @
4969 @fname{points} (@var{2d_xyz_array})
4971 Draws points in 2D and 3D.
4973 This object is affected by the following @i{graphic options}: @mrefcomma{point_size} 
4974 @mrefcomma{point_type} @mrefcomma{points_joined} @mrefcomma{line_width} @mrefcomma{key}
4975 @mref{line_type} and @code{color}. In 3D mode, it is also affected by @mref{enhanced3d}
4977 @b{2D}
4979 @code{points ([[@var{x1},@var{y1}], [@var{x2},@var{y2}],...])} or
4980 @code{points ([@var{x1},@var{x2},...], [@var{y1},@var{y2},...])}
4981 plots points @code{[x1,y1]}, @code{[x2,y2]}, etc. If abscissas
4982 are not given, they are set to consecutive positive integers, so that 
4983 @code{points ([@var{y1},@var{y2},...])} draws points @code{[1,@var{y1}]}, @code{[2,@var{y2}]}, etc.
4984 If @var{matrix} is a two-column or two-row matrix, @code{points (@var{matrix})}
4985 draws the associated points. If @var{matrix} is an one-column or one-row matrix,
4986 abscissas are assigned automatically.
4988 If @var{1d_y_array} is a 1D lisp array of numbers, @code{points (@var{1d_y_array})} plots them
4989 setting abscissas to consecutive positive integers. @code{points (@var{1d_x_array}, @var{1d_y_array})}
4990 plots points with their coordinates taken from the two arrays passed as arguments. If
4991 @var{2d_xy_array} is a 2D array with two columns, or with two rows, @code{points (@var{2d_xy_array})}
4992 plots the corresponding points on the plane.
4994 Examples:
4996 Two types of arguments for @code{points}, a list of pairs and two lists
4997 of separate coordinates.
4998 @example
4999 (%i1) draw2d(
5000         key = "Small points",
5001         points(makelist([random(20),random(50)],k,1,10)),
5002         point_type    = circle,
5003         point_size    = 3,
5004         points_joined = true,
5005         key           = "Great points",
5006         points(makelist(k,k,1,20),makelist(random(30),k,1,20)),
5007         point_type    = filled_down_triangle,
5008         key           = "Automatic abscissas",
5009         color         = red,
5010         points([2,12,8]))$
5011 @end example
5012 @figure{draw_points}
5014 Drawing impulses.
5015 @example
5016 (%i1) draw2d(
5017         points_joined = impulses,
5018         line_width    = 2,
5019         color         = red,
5020         points(makelist([random(20),random(50)],k,1,10)))$
5021 @end example
5022 @figure{draw_points2}
5024 Array with ordinates.
5025 @example
5026 (%i1) a: make_array (flonum, 100) $
5027 (%i2) for i:0 thru 99 do a[i]: random(1.0) $
5028 (%i3) draw2d(points(a)) $
5029 @end example
5030 @figure{draw_points3}
5032 Two arrays with separate coordinates.
5033 @example
5034 (%i1) x: make_array (flonum, 100) $
5035 (%i2) y: make_array (fixnum, 100) $
5036 (%i3) for i:0 thru 99 do (
5037         x[i]: float(i/100),
5038         y[i]: random(10) ) $
5039 (%i4) draw2d(points(x, y)) $
5040 @end example
5041 @figure{draw_points4}
5043 A two-column 2D array.
5044 @example
5045 (%i1) xy: make_array(flonum, 100, 2) $
5046 (%i2) for i:0 thru 99 do (
5047         xy[i, 0]: float(i/100),
5048         xy[i, 1]: random(10) ) $
5049 (%i3) draw2d(points(xy)) $
5050 @end example
5051 @figure{draw_points5}
5053 Drawing an array filled with function @code{read_array}.
5054 @example
5055 (%i1) a: make_array(flonum,100) $
5056 (%i2) read_array (file_search ("pidigits.data"), a) $
5057 (%i3) draw2d(points(a)) $
5058 @end example
5060 @b{3D}
5062 @code{points([[@var{x1}, @var{y1}, @var{z1}], [@var{x2}, @var{y2}, @var{z2}],
5063 ...])} or @code{points([@var{x1}, @var{x2}, ...], [@var{y1}, @var{y2}, ...],
5064 [@var{z1}, @var{z2},...])} plots points @code{[@var{x1}, @var{y1}, @var{z1}]},
5065 @code{[@var{x2}, @var{y2}, @var{z2}]}, etc.  If @var{matrix} is a three-column
5066 or three-row matrix, @code{points (@var{matrix})} draws the associated points.
5068 When arguments are lisp arrays, @code{points (@var{1d_x_array}, @var{1d_y_array}, @var{1d_z_array})}
5069 takes coordinates from the three 1D arrays.  If @var{2d_xyz_array} is a 2D array with three columns,
5070 or with three rows, @code{points (@var{2d_xyz_array})} plots the corresponding points.
5072 Examples:
5074 One tridimensional sample,
5075 @example
5076 (%i1) load ("numericalio")$
5077 (%i2) s2 : read_matrix (file_search ("wind.data"))$
5078 (%i3) draw3d(title = "Daily average wind speeds",
5079              point_size = 2,
5080              points(args(submatrix (s2, 4, 5))) )$
5081 @end example
5083 Two tridimensional samples,
5084 @example
5085 (%i1) load ("numericalio")$
5086 (%i2) s2 : read_matrix (file_search ("wind.data"))$
5087 (%i3) draw3d(
5088          title = "Daily average wind speeds. Two data sets",
5089          point_size = 2,
5090          key        = "Sample from stations 1, 2 and 3",
5091          points(args(submatrix (s2, 4, 5))),
5092          point_type = 4,
5093          key        = "Sample from stations 1, 4 and 5",
5094          points(args(submatrix (s2, 2, 3))) )$
5095 @end example
5097 Unidimensional arrays,
5098 @example
5099 (%i1) x: make_array (fixnum, 10) $
5100 (%i2) y: make_array (fixnum, 10) $
5101 (%i3) z: make_array (fixnum, 10) $
5102 (%i4) for i:0 thru 9 do (
5103         x[i]: random(10),
5104         y[i]: random(10),
5105         z[i]: random(10) ) $
5106 (%i5) draw3d(points(x,y,z)) $
5107 @end example
5108 @figure{draw_points6}
5110 Bidimensional colored array,
5111 @example
5112 (%i1) xyz: make_array(fixnum, 10, 3) $
5113 (%i2) for i:0 thru 9 do (
5114         xyz[i, 0]: random(10),
5115         xyz[i, 1]: random(10),
5116         xyz[i, 2]: random(10) ) $
5117 (%i3) draw3d(
5118          enhanced3d = true,
5119          points_joined = true,
5120          points(xyz)) $
5121 @end example
5122 @figure{draw_points7}
5124 Color numbers explicitly specified by the user.
5125 @example
5126 (%i1) pts: makelist([t,t^2,cos(t)], t, 0, 15)$
5127 (%i2) col_num: makelist(k, k, 1, length(pts))$
5128 (%i3) draw3d(
5129         enhanced3d = ['part(col_num,k),k],
5130         point_size = 3,
5131         point_type = filled_circle,
5132         points(pts))$
5133 @end example
5134 @figure{draw_points8}
5136 @opencatbox
5137 @category{Package draw}
5138 @closecatbox
5140 @end deffn
5144 @anchor{polar}
5145 @deffn  {Graphic object} polar (@var{radius},@var{ang},@var{minang},@var{maxang})
5146 Draws 2D functions defined in polar coordinates.
5148 @b{2D}
5150 @code{polar (@var{radius},@var{ang},@var{minang},@var{maxang})} plots function 
5151 @code{@var{radius}(@var{ang})} defined in polar coordinates, with variable 
5152 @var{ang} taking values from 
5153 @var{minang} to @var{maxang}.
5155 This object is affected by the following @i{graphic options}: @mrefcomma{nticks} 
5156 @mrefcomma{line_width} @mrefcomma{line_type} @mref{key} and @code{color}.
5158 Example:
5160 @example
5161 (%i1) draw2d(user_preamble = "set grid polar",
5162              nticks        = 200,
5163              xrange        = [-5,5],
5164              yrange        = [-5,5],
5165              color         = blue,
5166              line_width    = 3,
5167              title         = "Hyperbolic Spiral",
5168              polar(10/theta,theta,1,10*%pi) )$
5169 @end example
5170 @figure{draw_polar}
5172 @opencatbox
5173 @category{Package draw}
5174 @closecatbox
5176 @end deffn
5181 @anchor{polygon}
5182 @deffn  {Graphic object} polygon @
5183 @fname{polygon} ([[@var{x1}, @var{y1}], [@var{x2}, @var{y2}], @dots{}]) @
5184 @fname{polygon} ([@var{x1}, @var{x2}, @dots{}], [@var{y1}, @var{y2}, @dots{}])
5186 Draws polygons in 2D.
5188 @b{2D}
5190 The commands @code{polygon([[@var{x1}, @var{y1}], [@var{x2}, @var{y2}], ...])}
5191 or @code{polygon([@var{x1}, @var{x2}, ...], [@var{y1}, @var{y2}, ...])} plot on
5192 the plane a polygon with vertices @code{[@var{x1}, @var{y1}]}, @code{[@var{x2},
5193 @var{y2}]}, etc.
5195 This object is affected by the following @i{graphic options}: @mrefcomma{transparent} 
5196 @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width} @mrefcomma{key}
5197  @mref{line_type} and @code{color}.
5199 Example:
5201 @example
5202 (%i1) draw2d(color      = "#e245f0",
5203              line_width = 8,
5204              polygon([[3,2],[7,2],[5,5]]),
5205              border      = false,
5206              fill_color  = yellow,
5207              polygon([[5,2],[9,2],[7,5]]) )$
5208 @end example
5209 @figure{draw_polygon}
5211 @opencatbox
5212 @category{Package draw}
5213 @closecatbox
5215 @end deffn
5218 @anchor{quadrilateral}
5219 @deffn  {Graphic object} quadrilateral (@var{point_1}, @var{point_2}, @var{point_3}, @var{point_4})
5220 Draws a quadrilateral.
5222 @b{2D}
5224 @code{quadrilateral([@var{x1}, @var{y1}], [@var{x2}, @var{y2}], 
5225 [@var{x3}, @var{y3}], [@var{x4}, @var{y4}])} draws a quadrilateral with vertices
5226 @code{[@var{x1}, @var{y1}]}, @code{[@var{x2}, @var{y2}]}, 
5227 @code{[@var{x3}, @var{y3}]}, and @code{[@var{x4}, @var{y4}]}.
5229 This object is affected by the following @i{graphic options}:@*
5230 @mrefcomma{transparent} @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width}
5231 @mrefcomma{key} @mrefcomma{xaxis_secondary} @mrefcomma{yaxis_secondary} @mrefcomma{line_type}
5232 @code{transform} and @code{color}.
5234 Example:
5236 @example
5237 (%i1) draw2d(
5238         quadrilateral([1,1],[2,2],[3,-1],[2,-2]))$
5239 @end example
5240 @figure{draw_quadrilateral}
5242 @b{3D}
5244 @code{quadrilateral([@var{x1}, @var{y1}, @var{z1}], [@var{x2}, @var{y2},
5245 @var{z2}], [@var{x3}, @var{y3}, @var{z3}], [@var{x4}, @var{y4}, @var{z4}])}
5246 draws a quadrilateral with vertices @code{[@var{x1}, @var{y1}, @var{z1}]},
5247 @code{[@var{x2}, @var{y2}, @var{z2}]}, @code{[@var{x3}, @var{y3}, @var{z3}]},
5248 and @code{[@var{x4}, @var{y4}, @var{z4}]}.
5250 This object is affected by the following @i{graphic options}: @mrefcomma{line_type} 
5251 @mrefcomma{line_width} @mrefcomma{color} @mrefcomma{key} @mref{enhanced3d} and
5252 @mrefdot{transform}
5254 @opencatbox
5255 @category{Package draw}
5256 @closecatbox
5257 @end deffn
5259 @anchor{rectangle}
5260 @deffn  {Graphic object} rectangle ([@var{x1},@var{y1}], [@var{x2},@var{y2}])
5261 Draws rectangles in 2D.
5263 @b{2D}
5265 @code{rectangle ([@var{x1},@var{y1}], [@var{x2},@var{y2}])} draws a rectangle with opposite vertices
5266 @code{[@var{x1},@var{y1}]} and @code{[@var{x2},@var{y2}]}.
5268 This object is affected by the following @i{graphic options}: @mrefcomma{transparent} 
5269 @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width} @mrefcomma{key}
5270 @mref{line_type} and @code{color}.
5272 Example:
5274 @example
5275 (%i1) draw2d(fill_color  = red,
5276              line_width  = 6,
5277              line_type   = dots,
5278              transparent = false,
5279              fill_color  = blue,
5280              rectangle([-2,-2],[8,-1]), /* opposite vertices */
5281              transparent = true,
5282              line_type   = solid,
5283              line_width  = 1,
5284              rectangle([9,4],[2,-1.5]),
5285              xrange      = [-3,10],
5286              yrange      = [-3,4.5] )$
5287 @end example
5288 @figure{draw_rectangle}
5290 @opencatbox
5291 @category{Package draw}
5292 @closecatbox
5294 @end deffn
5299 @anchor{region}
5300 @deffn  {Graphic object} region (@var{expr},@var{var1},@var{minval1},@var{maxval1},@var{var2},@var{minval2},@var{maxval2})
5301 Plots a region on the plane defined by inequalities.
5303 @b{2D}
5304 @var{expr} is an expression formed by inequalities and boolean operators
5305 @code{and}, @code{or}, and @mrefdot{not} The region is bounded by the rectangle
5306 defined by @math{[@var{minval1}, @var{maxval1}]} and @math{[@var{minval2}, @var{maxval2}]}.
5308 This object is affected by the following @i{graphic options}: @mrefcomma{fill_color} 
5309 @mrefcomma{key} @mref{x_voxel} and @mrefdot{y_voxel}
5311 Example:
5313 @example
5314 (%i1) draw2d(
5315         x_voxel = 30,
5316         y_voxel = 30,
5317         region(x^2+y^2<1 and x^2+y^2 > 1/2,
5318                x, -1.5, 1.5, y, -1.5, 1.5));
5319 @end example
5320 @end deffn
5321 @figure{draw_region}
5324 @anchor{spherical}
5325 @deffn  {Graphic object} spherical (@var{radius}, @var{azi}, @var{minazi}, @var{maxazi}, @var{zen}, @var{minzen}, @var{maxzen})
5326 Draws 3D functions defined in spherical coordinates.
5328 @b{3D}
5330 @code{spherical(@var{radius}, @var{azi}, @var{minazi}, @var{maxazi}, @var{zen},
5331 @var{minzen}, @var{maxzen})} plots the function @code{@var{radius}(@var{azi},
5332 @var{zen})} defined in spherical coordinates, with @i{azimuth} @var{azi} taking
5333 values from @var{minazi} to @var{maxazi} and @i{zenith} @var{zen} taking values
5334 from @var{minzen} to @var{maxzen}.
5336 This object is affected by the following @i{graphic options}: @mrefcomma{xu_grid} 
5337 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{key} @mrefcomma{wired_surface} @mref{enhanced3d} and @code{color}.
5339 Example:
5341 @example
5342 (%i1) draw3d(spherical(1,a,0,2*%pi,z,0,%pi))$
5343 @end example
5344 @figure{draw_spherical}
5346 @opencatbox
5347 @category{Package draw}
5348 @closecatbox
5350 @end deffn
5353 @anchor{triangle}
5354 @deffn  {Graphic object} triangle (@var{point_1}, @var{point_2}, @var{point_3})
5355 Draws a triangle.
5357 @b{2D}
5359 @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}]},
5360 and @code{[@var{x3},@var{y3}]}.
5362 This object is affected by the following @i{graphic options}:@*
5363 @mrefcomma{transparent} @mrefcomma{fill_color} @mrefcomma{border} @mrefcomma{line_width}
5364 @mrefcomma{key} @mrefcomma{xaxis_secondary} @mrefcomma{yaxis_secondary} @mrefcomma{line_type}
5365 @mref{transform} and @code{color}.
5367 Example:
5369 @example
5370 (%i1) draw2d(
5371         triangle([1,1],[2,2],[3,-1]))$
5372 @end example
5373 @figure{draw_triangle}
5375 @b{3D}
5377 @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}]},
5378 @code{[@var{x2},@var{y2},@var{z2}]}, and @code{[@var{x3},@var{y3},@var{z3}]}.
5380 This object is affected by the following @i{graphic options}: @mrefcomma{line_type} 
5381 @mrefcomma{line_width} @mrefcomma{color} @mrefcomma{key} @mref{enhanced3d} and @mrefdot{transform}
5383 @opencatbox
5384 @category{Package draw}
5385 @closecatbox
5387 @end deffn
5390 @anchor{tube}
5391 @deffn  {Graphic object} tube (@var{xfun},@var{yfun},@var{zfun},@var{rfun},@var{p},@var{pmin},@var{pmax})
5392 Draws a tube in 3D with varying diameter.
5394 @b{3D}
5396 @code{[@var{xfun},@var{yfun},@var{zfun}]}
5397 is the parametric curve with parameter @var{p} taking values from @var{pmin}
5398 to @var{pmax}. Circles of radius @var{rfun} are placed with their centers on
5399 the parametric curve and perpendicular to it.
5401 This object is affected by the following @i{graphic options}: @mrefcomma{xu_grid} 
5402 @mrefcomma{yv_grid} @mrefcomma{line_type} @mrefcomma{line_width} @mrefcomma{key} @mrefcomma{wired_surface} @mrefcomma{enhanced3d}
5403 @mref{color} and @mrefdot{capping}
5405 Example:
5407 @example
5408 (%i1) draw3d(
5409         enhanced3d = true,
5410         xu_grid = 50,
5411         tube(cos(a), a, 0, cos(a/10)^2,
5412              a, 0, 4*%pi) )$
5413 @end example
5414 @figure{draw_tube}
5416 @opencatbox
5417 @category{Package draw}
5418 @closecatbox
5420 @end deffn
5424 @anchor{vector}
5425 @deffn  {Graphic object} vector @
5426 @fname{vector} ([@var{x},@var{y}], [@var{dx},@var{dy}]) @
5427 @fname{vector} ([@var{x},@var{y},@var{z}], [@var{dx},@var{dy},@var{dz}])
5429 Draws vectors in 2D and 3D.
5431 This object is affected by the following @i{graphic options}: @mrefcomma{head_both} 
5432 @mrefcomma{head_length} @mrefcomma{head_angle} @mrefcomma{head_type} @mrefcomma{line_width} 
5433 @mrefcomma{line_type} @mref{key} and @code{color}.
5435 @b{2D}
5437 @code{vector([@var{x},@var{y}], [@var{dx},@var{dy}])} plots vector
5438 @code{[@var{dx},@var{dy}]} with origin in @code{[@var{x},@var{y}]}.
5440 Example:
5442 @example
5443 (%i1) draw2d(xrange      = [0,12],
5444              yrange      = [0,10],
5445              head_length = 1,
5446              vector([0,1],[5,5]), /* default type */
5447              head_type = 'empty,
5448              vector([3,1],[5,5]),
5449              head_both = true,
5450              head_type = 'nofilled,
5451              line_type = dots,
5452              vector([6,1],[5,5]))$
5453 @end example
5454 @figure{draw_vector}
5456 @b{3D}
5458 @code{vector([@var{x},@var{y},@var{z}], [@var{dx},@var{dy},@var{dz}])} 
5459 plots vector @code{[@var{dx},@var{dy},@var{dz}]} with
5460 origin in @code{[@var{x},@var{y},@var{z}]}.
5462 Example:
5464 @example
5465 (%i1) draw3d(color = cyan,
5466              vector([0,0,0],[1,1,1]/sqrt(3)),
5467              vector([0,0,0],[1,-1,0]/sqrt(2)),
5468              vector([0,0,0],[1,1,-2]/sqrt(6)) )$
5469 @end example
5470 @figure{draw_vector2}
5472 @opencatbox
5473 @category{Package draw}
5474 @closecatbox
5476 @end deffn
5482 @node Functions and Variables for pictures, Functions and Variables for worldmap, Functions and Variables for draw, draw-pkg
5483 @section Functions and Variables for pictures
5487 @anchor{get_pixel}
5488 @deffn  {Function} get_pixel (@var{pic},@var{x},@var{y})
5489 Returns pixel from picture. Coordinates @var{x} and @var{y} range from 0 to
5490 @code{width-1} and @code{height-1}, respectively.
5492 @opencatbox
5493 @category{Package draw}
5494 @closecatbox
5496 @end deffn
5501 @anchor{make_level_picture}
5502 @deffn  {Function} make_level_picture @
5503 @fname{make_level_picture} (@var{data}) @
5504 @fname{make_level_picture} (@var{data},@var{width},@var{height})
5506 Returns a levels @var{picture} object. @code{make_level_picture (@var{data})}
5507 builds the @var{picture} object from matrix @var{data}.
5508 @code{make_level_picture (@var{data},@var{width},@var{height})}
5509 builds the object from a list of numbers; in this case, both the
5510 @var{width} and the @var{height} must be given.
5512 The returned @var{picture} object contains the following 
5513 four parts:
5515 @enumerate
5516 @item symbol @code{level}
5517 @item image width
5518 @item image height
5519 @item an integer array with pixel data ranging from 0 to 255.
5520 Argument @var{data} must contain only numbers ranged from 0 to 255;
5521 negative numbers are substituted by 0, and those which are
5522 greater than 255 are set to 255.
5523 @end enumerate
5525 Example:
5527 Level picture from matrix.
5528 @example
5529 (%i1) make_level_picture(matrix([3,2,5],[7,-9,3000]));
5530 (%o1)         picture(level, 3, 2, @{Array:  #(3 2 5 7 0 255)@})
5531 @end example
5533 Level picture from numeric list.
5534 @example
5535 (%i1) make_level_picture([-2,0,54,%pi],2,2);
5536 (%o1)            picture(level, 2, 2, @{Array:  #(0 0 54 3)@})
5537 @end example
5539 @opencatbox
5540 @category{Package draw}
5541 @closecatbox
5543 @end deffn
5548 @anchor{make_rgb_picture}
5549 @deffn  {Function} make_rgb_picture (@var{redlevel},@var{greenlevel},@var{bluelevel})
5550 Returns an rgb-coloured @var{picture} object. All three arguments must
5551 be levels picture; with red, green and blue levels.
5553 The returned @var{picture} object contains the following 
5554 four parts:
5556 @enumerate
5557 @item symbol @code{rgb}
5558 @item image width
5559 @item image height
5560 @item an integer array of length @var{3*width*height} with pixel data ranging
5561 from 0 to 255. Each pixel is represented by three consecutive numbers
5562 (red, green, blue).
5563 @end enumerate
5565 Example:
5567 @example
5568 (%i1) red: make_level_picture(matrix([3,2],[7,260]));
5569 (%o1)           picture(level, 2, 2, @{Array:  #(3 2 7 255)@})
5570 (%i2) green: make_level_picture(matrix([54,23],[73,-9]));
5571 (%o2)           picture(level, 2, 2, @{Array:  #(54 23 73 0)@})
5572 (%i3) blue: make_level_picture(matrix([123,82],[45,32.5698]));
5573 (%o3)          picture(level, 2, 2, @{Array:  #(123 82 45 33)@})
5574 (%i4) make_rgb_picture(red,green,blue);
5575 (%o4) picture(rgb, 2, 2, 
5576               @{Array:  #(3 54 123 2 23 82 7 73 45 255 0 33)@})
5577 @end example
5579 @opencatbox
5580 @category{Package draw}
5581 @closecatbox
5583 @end deffn
5589 @anchor{negative_picture}
5590 @deffn  {Function} negative_picture (@var{pic})
5591 Returns the negative of a (@var{level} or @var{rgb}) picture.
5593 @opencatbox
5594 @category{Package draw}
5595 @closecatbox
5596 @end deffn
5602 @anchor{picture_equalp}
5603 @deffn  {Function} picture_equalp (@var{x},@var{y})
5604 Returns @code{true} in case of equal pictures, and @code{false} otherwise.
5606 @opencatbox
5607 @category{Package draw}
5608 @category{Predicate functions}
5609 @closecatbox
5611 @end deffn
5616 @anchor{picturep}
5617 @deffn  {Function} picturep (@var{x})
5618 Returns @code{true} if the argument is a well formed image,
5619 and @code{false} otherwise.
5621 @opencatbox
5622 @category{Package draw}
5623 @category{Predicate functions}
5624 @closecatbox
5626 @end deffn
5630 @anchor{read_xpm}
5631 @deffn  {Function} read_xpm (@var{xpm_file})
5632 Reads a file in xpm and returns a picture object.
5634 @opencatbox
5635 @category{Package draw}
5636 @closecatbox
5638 @end deffn
5643 @anchor{rgb2level}
5644 @deffn  {Function} rgb2level (@var{pic})
5645 Transforms an @var{rgb} picture into a @var{level} one by
5646 averaging the red, green and blue channels.
5648 @opencatbox
5649 @category{Package draw}
5650 @closecatbox
5652 @end deffn
5657 @anchor{take_channel}
5658 @deffn  {Function} take_channel (@var{im},@var{color})
5659 If argument @var{color} is @code{red}, @code{green} or @code{blue},
5660 function @code{take_channel} returns the corresponding color channel of
5661 picture @var{im}.
5662 Example:
5664 @example
5665 (%i1) red: make_level_picture(matrix([3,2],[7,260]));
5666 (%o1)           picture(level, 2, 2, @{Array:  #(3 2 7 255)@})
5667 (%i2) green: make_level_picture(matrix([54,23],[73,-9]));
5668 (%o2)           picture(level, 2, 2, @{Array:  #(54 23 73 0)@})
5669 (%i3) blue: make_level_picture(matrix([123,82],[45,32.5698]));
5670 (%o3)          picture(level, 2, 2, @{Array:  #(123 82 45 33)@})
5671 (%i4) make_rgb_picture(red,green,blue);
5672 (%o4) picture(rgb, 2, 2, 
5673               @{Array:  #(3 54 123 2 23 82 7 73 45 255 0 33)@})
5674 (%i5) take_channel(%,'green);  /* simple quote!!! */
5675 (%o5)           picture(level, 2, 2, @{Array:  #(54 23 73 0)@})
5676 @end example
5678 @opencatbox
5679 @category{Package draw}
5680 @closecatbox
5682 @end deffn
5688 @node Functions and Variables for worldmap,  , Functions and Variables for pictures, draw-pkg
5689 @section Functions and Variables for worldmap
5691 @subsection Variables and Functions
5695 @anchor{boundaries_array}
5696 @defvr {Global variable} boundaries_array
5697 Default value: @code{false}
5699 @code{boundaries_array} is where the graphic object @code{geomap} looks
5700 for boundaries coordinates.
5702 Each component of @code{boundaries_array} is an array of floating
5703 point quantities, the coordinates of a polygonal segment or map boundary.
5705 See also @mrefdot{geomap}
5707 @opencatbox
5708 @category{Package draw}
5709 @closecatbox
5711 @end defvr
5717 @anchor{numbered_boundaries}
5718 @deffn  {Function} numbered_boundaries (@var{nlist})
5719 Draws a list of polygonal segments (boundaries), labeled by
5720 its numbers (@code{boundaries_array} coordinates). This is of great
5721 help when building new geographical entities.
5723 Example:
5725 Map of Europe labeling borders with their component number in
5726 @code{boundaries_array}.
5727 @example
5728 (%i1) load(worldmap)$
5729 (%i2) european_borders: 
5730            region_boundaries(-31.81,74.92,49.84,32.06)$
5731 (%i3) numbered_boundaries(european_borders)$
5732 @end example
5734 @opencatbox
5735 @category{Package draw}
5736 @closecatbox
5738 @end deffn
5743 @anchor{make_poly_continent}
5744 @deffn  {Function} make_poly_continent @
5745 @fname{make_poly_continent} (@var{continent_name}) @
5746 @fname{make_poly_continent} (@var{country_list})
5748 Makes the necessary polygons to draw a colored continent
5749 or a list of countries.
5751 Example:
5753 @example
5754 (%i1) load(worldmap)$
5755 (%i2) /* A continent */
5756       make_poly_continent(Africa)$
5757 (%i3) apply(draw2d, %)$
5758 @end example
5759 @figure{worldmap_make_poly_continent}
5760 @example
5761 (%i4) /* A list of countries */
5762       make_poly_continent([Germany,Denmark,Poland])$
5763 (%i5) apply(draw2d, %)$
5764 @end example
5765 @figure{worldmap_make_poly_continent2}
5767 @opencatbox
5768 @category{Package draw}
5769 @closecatbox
5771 @end deffn
5777 @anchor{make_poly_country}
5778 @deffn  {Function} make_poly_country (@var{country_name})
5779 Makes the necessary polygons to draw a colored country.
5780 If islands exist, one country can be defined with more than
5781 just one polygon.
5783 Example:
5785 @example
5786 (%i1) load(worldmap)$
5787 (%i2) make_poly_country(India)$
5788 (%i3) apply(draw2d, %)$
5789 @end example
5790 @figure{worldmap_make_poly_country}
5792 @opencatbox
5793 @category{Package draw}
5794 @closecatbox
5796 @end deffn
5802 @anchor{make_polygon}
5803 @deffn  {Function} make_polygon (@var{nlist})
5804 Returns a @code{polygon} object from boundary indices. Argument
5805 @var{nlist} is a list of components of @code{boundaries_array}.
5807 Example:
5809 Bhutan is defined by boundary numbers 171, 173
5810 and 1143, so that @code{make_polygon([171,173,1143])}
5811 appends arrays of coordinates @code{boundaries_array[171]},
5812 @code{boundaries_array[173]} and @code{boundaries_array[1143]} and 
5813 returns a @code{polygon} object suited to be plotted by 
5814 @code{draw}. To avoid an error message, arrays must be
5815 compatible in the sense that any two consecutive
5816 arrays have two coordinates in the extremes in common. In this
5817 example, the two first components of @code{boundaries_array[171]} are
5818 equal to the last two coordinates of @code{boundaries_array[173]}, and 
5819 the two first of @code{boundaries_array[173]} are equal to the two first
5820 of @code{boundaries_array[1143]}; in conclussion, boundary numbers
5821 171, 173 and 1143 (in this order) are compatible and the colored 
5822 polygon can be drawn.
5823 @example
5824 (%i1) load(worldmap)$
5825 (%i2) Bhutan;
5826 (%o2)                        [[171, 173, 1143]]
5827 (%i3) boundaries_array[171];
5828 (%o3) @{Array:  
5829        #(88.750549 27.14727 88.806351 27.25305 88.901367 27.282221
5830          88.917877 27.321039)@}
5831 (%i4) boundaries_array[173];
5832 (%o4) @{Array:
5833        #(91.659554 27.76511 91.6008 27.66666 91.598022 27.62499
5834          91.631348 27.536381 91.765533 27.45694 91.775253 27.4161 
5835          92.007751 27.471939 92.11441 27.28583 92.015259 27.168051
5836          92.015533 27.08083 92.083313 27.02277 92.112183 26.920271
5837          92.069977 26.86194 91.997192 26.85194 91.915253 26.893881
5838          91.916924 26.85416 91.8358 26.863331 91.712479 26.799999 
5839          91.542191 26.80444 91.492188 26.87472 91.418854 26.873329
5840          91.371353 26.800831 91.307457 26.778049 90.682457 26.77417
5841          90.392197 26.903601 90.344131 26.894159 90.143044 26.75333
5842          89.98996 26.73583 89.841919 26.70138 89.618301 26.72694 
5843          89.636093 26.771111 89.360786 26.859989 89.22081 26.81472
5844          89.110237 26.829161 88.921631 26.98777 88.873016 26.95499
5845          88.867737 27.080549 88.843307 27.108601 88.750549 
5846          27.14727)@}
5847 (%i5) boundaries_array[1143];
5848 (%o5) @{Array:  
5849        #(91.659554 27.76511 91.666924 27.88888 91.65831 27.94805 
5850          91.338028 28.05249 91.314972 28.096661 91.108856 27.971109
5851          91.015808 27.97777 90.896927 28.05055 90.382462 28.07972
5852          90.396088 28.23555 90.366074 28.257771 89.996353 28.32333
5853          89.83165 28.24888 89.58609 28.139999 89.35997 27.87166 
5854          89.225517 27.795 89.125793 27.56749 88.971077 27.47361
5855          88.917877 27.321039)@}
5856 (%i6) Bhutan_polygon: make_polygon([171,173,1143])$
5857 (%i7) draw2d(Bhutan_polygon)$
5858 @end example
5859 @figure{worldmap_make_polygon}
5861 @opencatbox
5862 @category{Package draw}
5863 @closecatbox
5865 @end deffn
5871 @anchor{region_boundaries}
5872 @deffn  {Function} region_boundaries (@var{x1},@var{y1},@var{x2},@var{y2})
5873 Detects polygonal segments of global variable @code{boundaries_array}
5874 fully contained in the rectangle with vertices (@var{x1},@var{y1}) -upper left- 
5875 and (@var{x2},@var{y2}) -bottom right-.
5877 Example:
5879 Returns segment numbers for plotting southern Italy.
5880 @example
5881 (%i1) load(worldmap)$
5882 (%i2) region_boundaries(10.4,41.5,20.7,35.4);
5883 (%o2)                [1846, 1863, 1864, 1881, 1888, 1894]
5884 (%i3) draw2d(geomap(%))$
5885 @end example
5886 @figure{worldmap_region_boundaries}
5888 @opencatbox
5889 @category{Package draw}
5890 @closecatbox
5892 @end deffn
5896 @anchor{region_boundaries_plus}
5897 @deffn  {Function} region_boundaries_plus (@var{x1},@var{y1},@var{x2},@var{y2})
5898 Detects polygonal segments of global variable @code{boundaries_array}
5899 containing at least one vertex in the rectangle defined by vertices (@var{x1},@var{y1})
5900 -upper left- and (@var{x2},@var{y2}) -bottom right-.
5902 Example:
5904 @example
5905 (%i1) load(worldmap)$
5906 (%i2) region_boundaries_plus(10.4,41.5,20.7,35.4);
5907 (%o2) [1060, 1062, 1076, 1835, 1839, 1844, 1846, 1858,
5908        1861, 1863, 1864, 1871, 1881, 1888, 1894, 1897]
5909 (%i3) draw2d(geomap(%))$
5910 @end example
5911 @figure{worldmap_region_boundaries_plus}
5913 @opencatbox
5914 @category{Package draw}
5915 @closecatbox
5917 @end deffn
5922 @subsection Graphic objects
5925 @anchor{geomap}
5926 @deffn  {Graphic object} geomap @
5927 @fname{geomap} (@var{numlist}) @
5928 @fname{geomap} (@var{numlist},@var{3Dprojection})
5930 Draws cartographic maps in 2D and 3D.
5932 @b{2D}
5934 This function works together with global variable @code{boundaries_array}.
5936 Argument @var{numlist} is a list containing numbers or lists of numbers.
5937 All these numbers must be integers greater or equal than zero, 
5938 representing the components of global array @code{boundaries_array}.
5940 Each component of @code{boundaries_array} is an array of floating
5941 point quantities, the coordinates of a polygonal segment or map boundary.
5943 @code{geomap (@var{numlist})} flattens its arguments and draws the
5944 associated boundaries in @code{boundaries_array}.
5946 This object is affected by the following @i{graphic options}: @mrefcomma{line_width} 
5947 @mref{line_type} and @code{color}.
5949 Examples:
5951 A simple map defined by hand:
5952 @example
5953 (%i1) load(worldmap)$
5954 (%i2) /* Vertices of boundary #0: @{(1,1),(2,5),(4,3)@} */
5955    ( bnd0: make_array(flonum,6),
5956      bnd0[0]:1.0, bnd0[1]:1.0, bnd0[2]:2.0,
5957      bnd0[3]:5.0, bnd0[4]:4.0, bnd0[5]:3.0 )$
5958 (%i3) /* Vertices of boundary #1: @{(4,3),(5,4),(6,4),(5,1)@} */
5959    ( bnd1: make_array(flonum,8),
5960      bnd1[0]:4.0, bnd1[1]:3.0, bnd1[2]:5.0, bnd1[3]:4.0,
5961      bnd1[4]:6.0, bnd1[5]:4.0, bnd1[6]:5.0, bnd1[7]:1.0)$
5962 (%i4) /* Vertices of boundary #2: @{(5,1), (3,0), (1,1)@} */
5963    ( bnd2: make_array(flonum,6),
5964      bnd2[0]:5.0, bnd2[1]:1.0, bnd2[2]:3.0,
5965      bnd2[3]:0.0, bnd2[4]:1.0, bnd2[5]:1.0 )$
5966 (%i5) /* Vertices of boundary #3: @{(1,1), (4,3)@} */
5967    ( bnd3: make_array(flonum,4),
5968      bnd3[0]:1.0, bnd3[1]:1.0, bnd3[2]:4.0, bnd3[3]:3.0)$
5969 (%i6) /* Vertices of boundary #4: @{(4,3), (5,1)@} */
5970    ( bnd4: make_array(flonum,4),
5971      bnd4[0]:4.0, bnd4[1]:3.0, bnd4[2]:5.0, bnd4[3]:1.0)$
5972 (%i7) /* Pack all together in boundaries_array */
5973    ( boundaries_array: make_array(any,5),
5974      boundaries_array[0]: bnd0, boundaries_array[1]: bnd1,
5975      boundaries_array[2]: bnd2, boundaries_array[3]: bnd3,
5976      boundaries_array[4]: bnd4 )$
5977 (%i8) draw2d(geomap([0,1,2,3,4]))$
5978 @end example
5979 @figure{worldmap_geomap}
5981 The auxiliary package @code{worldmap} sets the global variable
5982 @code{boundaries_array} to real world boundaries in
5983 (longitude, latitude) coordinates. These data are in the 
5984 public domain and come from 
5985 @c Link is dead, linked to archive.org. Does someone know a better Link?
5986 @url{https://web.archive.org/web/20100310124019/http://www-cger.nies.go.jp/grid-e/gridtxt/grid19.html}.
5987 Package @code{worldmap} defines also boundaries for countries,
5988 continents and coastlines as lists with the necessary components of 
5989 @code{boundaries_array} (see file @code{share/draw/worldmap.mac}
5990 for more information). Package @code{worldmap} automatically loads 
5991 package @code{worldmap}.
5992 @example
5993 (%i1) load(worldmap)$
5994 (%i2) c1: gr2d(geomap([Canada,United_States,
5995                        Mexico,Cuba]))$
5996 (%i3) c2: gr2d(geomap(Africa))$
5997 (%i4) c3: gr2d(geomap([Oceania,China,Japan]))$
5998 (%i5) c4: gr2d(geomap([France,Portugal,Spain,
5999                        Morocco,Western_Sahara]))$
6000 (%i6) draw(columns  = 2,
6001            c1,c2,c3,c4)$
6002 @end example
6003 @figure{worldmap_geomap2}
6005 Package @code{worldmap} is also useful for plotting
6006 countries as polygons. In this case, graphic object
6007 @code{geomap} is no longer necessary and the @code{polygon}
6008 object is used instead. Since lists are now used and not
6009 arrays, maps rendering will be slower. See also @mref{make_poly_country}
6010 and @mref{make_poly_continent} to understand the following code.
6011 @example
6012 (%i1) load(worldmap)$
6013 (%i2) mymap: append(
6014    [color      = white],  /* borders are white */
6015    [fill_color = red],             make_poly_country(Bolivia),
6016    [fill_color = cyan],            make_poly_country(Paraguay),
6017    [fill_color = green],           make_poly_country(Colombia),
6018    [fill_color = blue],            make_poly_country(Chile),
6019    [fill_color = "#23ab0f"],       make_poly_country(Brazil),
6020    [fill_color = goldenrod],       make_poly_country(Argentina),
6021    [fill_color = "midnight-blue"], make_poly_country(Uruguay))$
6022 (%i3) apply(draw2d, mymap)$
6023 @end example
6024 @figure{worldmap_geomap3}
6027 @b{3D}
6029 @code{geomap (@var{numlist})} projects map boundaries on the sphere of radius 1
6030 centered at (0,0,0). It is possible to change the sphere or the projection type
6031 by using @code{geomap (@var{numlist},@var{3Dprojection})}.
6033 Available 3D projections:
6035 @itemize @bullet
6036 @item
6037 @code{[spherical_projection,@var{x},@var{y},@var{z},@var{r}]}: projects map boundaries on the sphere of
6038 radius @var{r} centered at (@var{x},@var{y},@var{z}).
6039 @example
6040 (%i1) load(worldmap)$
6041 (%i2) draw3d(geomap(Australia), /* default projection */
6042              geomap(Australia,
6043                     [spherical_projection,2,2,2,3]))$
6044 @end example
6045 @figure{worldmap_geomap4}
6047 @item
6048 @code{[cylindrical_projection,@var{x},@var{y},@var{z},@var{r},@var{rc}]}: re-projects spherical map boundaries on the cylinder of radius
6049 @var{rc} and axis passing through the poles of the globe of radius @var{r} centered at (@var{x},@var{y},@var{z}).
6050 @example
6051 (%i1) load(worldmap)$
6052 (%i2) draw3d(geomap([America_coastlines,Eurasia_coastlines],
6053                     [cylindrical_projection,2,2,2,3,4]))$
6054 @end example
6055 @figure{worldmap_geomap5}
6057 @item
6058 @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},
6059 with axis passing through the poles of the globe of radius @var{r} centered at (@var{x},@var{y},@var{z}). Both 
6060 the northern and southern cones are tangent to sphere.
6061 @example
6062 (%i1) load(worldmap)$
6063 (%i2) draw3d(geomap(World_coastlines,
6064                     [conic_projection,0,0,0,1,90]))$
6065 @end example
6066 @end itemize
6067 @figure{worldmap_geomap6}
6069 See also @url{http://riotorto.users.sf.net/gnuplot/geomap}
6070 for more elaborated examples.
6072 @opencatbox
6073 @category{Package draw}
6074 @closecatbox
6076 @end deffn