libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmGnuPlot.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //| Copyright: (C) 2009-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. #ifndef cmGnuPlot_h
  4. #define cmGnuPlot_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc:"Interface to GNU Plot." kw:[plot]}
  9. enum
  10. {
  11. kOkPlRC,
  12. kSignalFailedPlRC,
  13. kPipeFailedPlRC,
  14. kForkFailedPlRC,
  15. kExecFailedPlRC,
  16. kPipeCloseFailedPlRC,
  17. kPlotNotFoundPlRC,
  18. kNoCurPlotPlRC,
  19. kPlotDataFileFailPlRC,
  20. kFopenFailedPlRC,
  21. kFcloseFailedPlRC
  22. };
  23. enum
  24. {
  25. kInvalidPlotPtId = 0x000,
  26. kPlusPlotPtId = 0x001,
  27. kXPlotPtId = 0x002,
  28. kAsteriskPlotPtId = 0x003,
  29. kSquarePlotPtId = 0x004,
  30. kFillSquarePlotPtId = 0x005,
  31. kCirclePlotPtId = 0x006,
  32. kFillCirclePlotPtId = 0x007,
  33. kTriPlotPtId = 0x008,
  34. kFillTriPlotPtId = 0x009,
  35. kInvTriPlotPtId = 0x00a,
  36. kInvFillTriPlotPtId = 0x00b,
  37. kDiamondPlotPtId = 0x00c,
  38. kFillDiamonPlotPtId = 0x00d,
  39. kPlotPtMask = 0x00f,
  40. };
  41. enum
  42. {
  43. kInvalidPlotLineId = 0x000, // -2 after translation
  44. kSolidPlotLineId = 0x010, // -1 after translation
  45. kDashPlotLineId = 0x020, // 0 after translation
  46. kPlotLineMask = 0x0f0,
  47. kPlotLineShift = 4
  48. };
  49. enum
  50. {
  51. kImpulsePlotFl = 0x100
  52. };
  53. /// Set terminal to NULL to use the default terminal.
  54. cmRC_t cmPlotInitialize( const char* terminalStr );
  55. // Combines initializaion and setup in a single call.
  56. cmRC_t cmPlotInitialize2( const char* terminalStr, const char* title, unsigned rowCnt, unsigned colCnt );
  57. cmRC_t cmPlotFinalize();
  58. /// Setup the plot page
  59. cmRC_t cmPlotSetup( const char* title, unsigned rowCnt, unsigned colCnt );
  60. /// Select sub-plot to apply subsequent commands to
  61. cmRC_t cmPlotSelectSubPlot( unsigned ri, unsigned ci );
  62. /// Clear the current current subplot
  63. cmRC_t cmPlotClear();
  64. /// Set the labels on the current sub-plot
  65. cmRC_t cmPlotSetLabels( const char* title, const char* xLabelStr, const char* yLabelStr, const char* zLabelStr );
  66. /// Set the default ranges for the x, y and z axes. To leave the ranges at their current values set the min and max to -1.
  67. /// The range values are used to form data sets when data is not explicitely given.
  68. cmRC_t cmPlotSetRange( double xMin, double xMax, double yMin, double yMax, double zMin, double zMax );
  69. /// If x or y is given as NULL then the values will be taken from the range settings xMin:xMax or yMin:yMax.
  70. /// Use the gnuplot command:'test' to see the valid lineType and pointType values for a given terminal
  71. /// Color string may be any of the predefined color labels: show palette colornames or and rgb value: e.g. #FF00FF
  72. cmRC_t cmPlotLineF( const char* legendStr, const float* x, const float* y, const float* z, unsigned n, const char* colorStr, unsigned styleFlags );
  73. cmRC_t cmPlotLineD( const char* legendStr, const double* x, const double* y, const double* z, unsigned n, const char* colorStr, unsigned styleFlags );
  74. cmRC_t cmPlotLineMD( const double* x, const double* y, const double* z, unsigned rn, unsigned cn, unsigned styleFlags );
  75. #if CM_FLOAT_SMP == 1
  76. #define cmPlotLineS cmPlotLineF
  77. #else
  78. #define cmPlotLineS cmPlotLineD
  79. #endif
  80. #if CM_FLOAT_REAL == 1
  81. #define cmPlotLineR cmPlotLineF
  82. #else
  83. #define cmPlotLineR cmPlotLineD
  84. #endif
  85. cmRC_t cmPlotDraw();
  86. cmRC_t cmPlotPrint( bool printDataFl );
  87. cmRC_t cmPlotDrawAndPrint( bool printDataFl );
  88. //)
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif