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.

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