gplot.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. * gplot.h
  30. *
  31. * Data structures and parameters for generating gnuplot files
  32. */
  33. #define GPLOT_VERSION_NUMBER 1
  34. #define NUM_GPLOT_STYLES 5
  35. enum GPLOT_STYLE {
  36. GPLOT_LINES = 0,
  37. GPLOT_POINTS = 1,
  38. GPLOT_IMPULSES = 2,
  39. GPLOT_LINESPOINTS = 3,
  40. GPLOT_DOTS = 4
  41. };
  42. #define NUM_GPLOT_OUTPUTS 6
  43. enum GPLOT_OUTPUT {
  44. GPLOT_NONE = 0,
  45. GPLOT_PNG = 1,
  46. GPLOT_PS = 2,
  47. GPLOT_EPS = 3,
  48. GPLOT_X11 = 4,
  49. GPLOT_LATEX = 5
  50. };
  51. enum GPLOT_SCALING {
  52. GPLOT_LINEAR_SCALE = 0, /* default */
  53. GPLOT_LOG_SCALE_X = 1,
  54. GPLOT_LOG_SCALE_Y = 2,
  55. GPLOT_LOG_SCALE_X_Y = 3
  56. };
  57. extern const char *gplotstylenames[]; /* used in gnuplot cmd file */
  58. extern const char *gplotfilestyles[]; /* used in simple file input */
  59. extern const char *gplotfileoutputs[]; /* used in simple file input */
  60. struct GPlot
  61. {
  62. char *rootname; /* for cmd, data, output */
  63. char *cmdname; /* command file name */
  64. struct Sarray *cmddata; /* command file contents */
  65. struct Sarray *datanames; /* data file names */
  66. struct Sarray *plotdata; /* plot data (1 string/file) */
  67. struct Sarray *plottitles; /* title for each individual plot */
  68. struct Numa *plotstyles; /* plot style for individual plots */
  69. l_int32 nplots; /* current number of plots */
  70. char *outname; /* output file name */
  71. l_int32 outformat; /* GPLOT_OUTPUT values */
  72. l_int32 scaling; /* GPLOT_SCALING values */
  73. char *title; /* optional */
  74. char *xlabel; /* optional x axis label */
  75. char *ylabel; /* optional y axis label */
  76. };
  77. typedef struct GPlot GPLOT;
  78. #endif /* LEPTONICA_GPLOT_H */