gplot.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*====================================================================*
  2. - Copyright (C) 2001 Leptonica. All rights reserved.
  3. -
  4. - Redistribution and use in source and binary forms, with or without
  5. - modification, are permitted provided that the following conditions
  6. - are met:
  7. - 1. Redistributions of source code must retain the above copyright
  8. - notice, this list of conditions and the following disclaimer.
  9. - 2. Redistributions in binary form must reproduce the above
  10. - copyright notice, this list of conditions and the following
  11. - disclaimer in the documentation and/or other materials
  12. - provided with the distribution.
  13. -
  14. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  15. - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
  18. - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  19. - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  20. - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  21. - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  22. - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  23. - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *====================================================================*/
  26. #ifndef LEPTONICA_GPLOT_H
  27. #define LEPTONICA_GPLOT_H
  28. /*!
  29. * \file gplot.h
  30. *
  31. * <pre>
  32. * Data structures and parameters for generating gnuplot files
  33. *
  34. * We used to support X11 output, but recent versions of gnuplot do not
  35. * support the X11 terminal. To get display to your screen, use
  36. * GPLOT_PNG output; e.g.,
  37. * gplotSimple1(na, GPLOT_PNG, "/tmp/someroot", ...);
  38. * l_fileDisplay("/tmp/someroot.png", ...);
  39. * </pre>
  40. */
  41. #define GPLOT_VERSION_NUMBER 1
  42. #define NUM_GPLOT_STYLES 5
  43. enum GPLOT_STYLE {
  44. GPLOT_LINES = 0,
  45. GPLOT_POINTS = 1,
  46. GPLOT_IMPULSES = 2,
  47. GPLOT_LINESPOINTS = 3,
  48. GPLOT_DOTS = 4
  49. };
  50. #define NUM_GPLOT_OUTPUTS 5
  51. enum GPLOT_OUTPUT {
  52. GPLOT_NONE = 0,
  53. GPLOT_PNG = 1,
  54. GPLOT_PS = 2,
  55. GPLOT_EPS = 3,
  56. GPLOT_LATEX = 4
  57. };
  58. enum GPLOT_SCALING {
  59. GPLOT_LINEAR_SCALE = 0, /*!< default */
  60. GPLOT_LOG_SCALE_X = 1,
  61. GPLOT_LOG_SCALE_Y = 2,
  62. GPLOT_LOG_SCALE_X_Y = 3
  63. };
  64. extern const char *gplotstylenames[]; /*!< used in gnuplot cmd file */
  65. extern const char *gplotfileoutputs[]; /*!< used in simple file input */
  66. /*! Data structure for generating gnuplot files */
  67. struct GPlot
  68. {
  69. char *rootname; /*!< for cmd, data, output */
  70. char *cmdname; /*!< command file name */
  71. struct Sarray *cmddata; /*!< command file contents */
  72. struct Sarray *datanames; /*!< data file names */
  73. struct Sarray *plotdata; /*!< plot data (1 string/file) */
  74. struct Sarray *plottitles; /*!< title for each individual plot */
  75. struct Numa *plotstyles; /*!< plot style for individual plots */
  76. l_int32 nplots; /*!< current number of plots */
  77. char *outname; /*!< output file name */
  78. l_int32 outformat; /*!< GPLOT_OUTPUT values */
  79. l_int32 scaling; /*!< GPLOT_SCALING values */
  80. char *title; /*!< optional */
  81. char *xlabel; /*!< optional x axis label */
  82. char *ylabel; /*!< optional y axis label */
  83. };
  84. typedef struct GPlot GPLOT;
  85. #endif /* LEPTONICA_GPLOT_H */