gnuplot.tex 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. \chapter[GNUPLOT: Plotting Functions]%
  2. {GNUPLOT: Display of functions and surfaces}
  3. \label{GNUPLOT}
  4. \typeout{{GNUPLOT: Display of functions and surfaces}}
  5. {\footnotesize
  6. \begin{center}
  7. Herbert Melenk \\
  8. Konrad--Zuse--Zentrum f\"ur Informationstechnik Berlin \\
  9. Takustra\"se 7 \\
  10. D--14195 Berlin--Dahlem, Germany \\[0.05in]
  11. e--mail: melenk@zib.de
  12. \end{center}
  13. }
  14. \ttindex{GNUPLOT}
  15. The {\bf gnuplot} system provides easy to use graphics output for
  16. curves or surfaces which are defined by formulas and/or data sets.
  17. The \REDUCE\ GNUPLOT package lets one use the GNUPLOT graphical output
  18. directly from inside \REDUCE, either for the interactive display of
  19. curves/surfaces or for the production of pictures on paper.
  20. For a full understanding of use of the \REDUCE\ GNUPLOT package it is
  21. best to be familiar with {\bf gnuplot}.
  22. The main command is {\tt PLOT}\ttindex{PLOT}. It accepts an arbitrary
  23. list of arguments which are either an expression to be plotted, a
  24. range expressions or an option.
  25. \begin{verbatim}
  26. load_package gnuplot;
  27. plot(w=sin(a),a=(0 .. 10),xlabel="angle",ylabel="sine");
  28. \end{verbatim}
  29. The expression can be in one or two unknowns, or a list of two
  30. functions for the x and y values. It can also be an implicit equation
  31. in 2-dimensional space.
  32. \begin{verbatim}
  33. plot(x**3+x*y**3-9x=0);
  34. \end{verbatim}
  35. The dependent and independent variables can be limited to a range with
  36. the syntax shown in the first example. If omitted the independent
  37. variables range from -10 to 10 and the dependent variable is limited
  38. only by the precision of the IEEE floating point arithmetic.
  39. There are a great deal of options, either as keywords or as
  40. {\tt variable=string}. Options include:
  41. {\tt title}\ttindex{title}: assign a heading (default: empty)
  42. {\tt xlabel}\ttindex{xlabel}: set label for the x axis
  43. {\tt ylabel}\ttindex{ylabel}: set label for the y axis
  44. {\tt zlabel}\ttindex{zlabel}: set label for the z axis
  45. {\tt terminal}\ttindex{terminal}: select an output device
  46. {\tt size}\ttindex{size}: rescale the picture
  47. {\tt view}\ttindex{view}: set a viewpoint
  48. {\tt (no)}{\tt contour}\ttindex{contour}: 3d: add contour lines
  49. {\tt (no)}{\tt surface}\ttindex{surface}: 3d: draw surface (default: yes)
  50. {\tt (no)}{\tt hidden3d}\ttindex{hidden3d}: 3d: remove hidden lines (default: no)
  51. The command {\tt PLOTRESET}\ttindex{PLOTRESET} closes the current
  52. GNUPLOT windows. The next call to {\tt PLOT} will create a new
  53. one.
  54. GNUPLOT is controlled by a number of switches.
  55. Normally all intermediate data sets are deleted after terminating
  56. a plot session. If the switch {\tt PLOTKEEP}\ttindex{PLOTKEEP} is set on,
  57. the data sets are kept for eventual post processing independent
  58. of \REDUCE.
  59. In general {\tt PLOT} tries to generate smooth pictures by evaluating
  60. the functions at interior points until the distances are fine enough.
  61. This can require a lot of computing time if the single function
  62. evaluation is expensive. The refinement is controlled by the switch
  63. {\tt PLOTREFINE}\ttindex{PLOTREFINE} which is on by default. When you
  64. turn it off the functions will be evaluated only at the basic points.
  65. The integer value of the global variable {\tt
  66. PLOT\_XMESH}\ttindex{PLOT\_XMESH} defines the number of initial
  67. function evaluations in x direction for \f{PLOT}. For 2d graphs
  68. additional points will be used as long as {\tt
  69. plotrefine}\ttindex{plotrefine} is on. For 3d graphs this number
  70. defines also the number of mesh lines orthogonal to the x axis. {\tt
  71. PLOT\_YMESH}\ttindex{PLOT\_YMESH} defines for 3d plots the number of
  72. function evaluations in the y direction and the number of mesh lines
  73. orthogonal to the y axis.
  74. The grid for localising an implicitly defined curve in \f{PLOT}
  75. consists of triangles. These are computed initially equally
  76. distributed over the x-y plane controlled by {\tt PLOT\_XMESH}. The
  77. grid is refined adaptively in several levels. The final grid can be
  78. visualised by setting on the switch {\tt
  79. SHOW\_GRID}\ttindex{SHOW\_GRID}.