SNAP Library 2.4, User Reference  2015-05-11 19:40:56
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gnuplot.h
Go to the documentation of this file.
1 #ifndef gnuplot_h
2 #define gnuplot_h
3 
5 // GNU-Plot-Chart
6 typedef enum {
9 } TGpScaleTy;
10 
11 typedef enum {
14 } TGpSeriesTy;
15 
16 class TGnuPlot {
17 public:
19  static TStr GnuPlotPath;
21  static TStr GnuPlotFNm;
22  static TStr DefPlotFNm;
23  static TStr DefDataFNm;
24 private:
25  class TGpSeries {
26  public:
29  TFltV ZValV; // error bar and 3d plots
31  int XCol, YCol, ZCol;
32  public:
33  TGpSeries() : SeriesTy(gpwLines), XYValV(), ZValV(), Label(), WithStyle(), DataFNm(), XCol(0), YCol(0), ZCol(0) { }
34  TGpSeries(const TGpSeries& Gps);
35  TGpSeries& operator = (const TGpSeries& Gps);
36  bool operator < (const TGpSeries& Gps) const;
37  bool SaveXVals() const { return (YCol-XCol)==1; }
38  };
39  class TGpSeriesCmp {
40  private:
42  public:
43  TGpSeriesCmp(const TVec<TGpSeries>& _SeriesV) : SeriesV(_SeriesV) { }
44  bool operator () (const int& Left, const int& Right) const {
45  return SeriesV[Left] > SeriesV[Right]; }
46  };
47 private:
48  static int Tics42; // 1 - "set ticks", 0 - "set ticscale"
49  // -1 - unknown, -2 - not initialized
57 public:
58  static int GetTics42();
59 public:
60  TStr GetSeriesPlotStr(const int& PlotN);
61  int IsSameXCol(const int& CurId, const int& PrevId) const;
62  void CreatePlotFile(const TStr& Comment = TStr());
63  void RunGnuPlot() const;
64 public:
65  TGnuPlot(const TStr& FileNm="gplot", const TStr& PlotTitle=TStr(), const bool& Grid=true);
66  TGnuPlot(const TStr& DataFileNm, const TStr& PlotFileNm, const TStr& PlotTitle, const bool& Grid);
67  TGnuPlot(const TGnuPlot& GnuPlot);
68  TGnuPlot& operator = (const TGnuPlot& GnuPlot);
69 
70  void SetTitle(const TStr& PlotTitle) { Title = PlotTitle; }
71  void SetXLabel(const TStr& XLabel) { LblX = XLabel; }
72  void SetYLabel(const TStr& YLabel) { LblY = YLabel; }
73  void SetXYLabel(const TStr& XLabel, const TStr& YLabel) { LblX = XLabel; LblY = YLabel; }
74  void SetDataPlotFNm(const TStr& DatFNm, const TStr& PltFNm) { DataFNm = DatFNm; PlotFNm = PltFNm; }
75 
76  void ShowGrid(const bool& Show) { SetGrid = Show; }
77  void Pause(const bool& DoPause) { SetPause = DoPause; }
78  void SetScale(const TGpScaleTy& GpScaleTy) { ScaleTy = GpScaleTy;}
79  void SetXRange(const double& Min, const double& Max) { XRange = TFltPr(Min, Max); }
80  void SetYRange(const double& Min, const double& Max) { YRange = TFltPr(Min, Max); }
81  void AddCmd(const TStr& Cmd) { MoreCmds.Add(Cmd); }
82  TStr GetLineStyle(const int& PlotId) const { return SeriesV[PlotId].WithStyle; }
83  void SetLineStyle(const int& PlotId, const TStr& StyleStr) { SeriesV[PlotId].WithStyle = StyleStr; }
84 
85  int AddFunc(const TStr& FuncStr, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
86  int AddPlot(const TIntV& YValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
87  int AddPlot(const TFltV& YValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
88  int AddPlot(const TFltV& XValV, const TFltV& YValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
89  int AddPlot(const TIntPrV& XYValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
90  int AddPlot(const TFltPrV& XYValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
91  int AddPlot(const TIntKdV& XYValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
92  int AddPlot(const TFltKdV& XYValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
93  int AddPlot(const TIntFltKdV& XYValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
94  int AddPlot(const TIntFltPrV& XYValV, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
95  int AddPlot(const TStr& DataFNm, const int& ColY, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
96  int AddPlot(const TStr& DataFNm, const int& ColX, const int& ColY, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr());
97  template<class TKey, class TDat, class THashFunc>
98  int AddPlot(const THash<TKey, TDat, THashFunc>& XYValH, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr(), const bool& ExpBucket = false);
99  template<class TKey, class THashFunc>
100  int AddPlot(const THash<TKey, TMom, THashFunc>& ValMomH, const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& Label=TStr(), const TStr& Style=TStr(),
101  bool PlotAvg=true, bool PlotMed=true, bool PlotMin=false, bool PlotMax=false, bool PlotSDev=false, bool PlotStdErr=false, const bool& ExpBucket=false);
102 
103  int AddErrBar(const TFltTrV& XYDValV, const TStr& Label=TStr());
104  int AddErrBar(const TFltTrV& XYDValV, const TStr& DatLabel, const TStr& ErrLabel);
105  int AddErrBar(const TFltV& YValV, const TFltV& DeltaYV, const TStr& Label=TStr());
106  int AddErrBar(const TFltV& XValV, const TFltV& YValV, const TFltV& DeltaYV, const TStr& Label=TStr());
107  int AddErrBar(const TFltPrV& XYValV, const TFltV& DeltaYV, const TStr& Label=TStr());
108  int AddErrBar(const TFltKdV& XYValV, const TFltV& DeltaYV, const TStr& Label=TStr());
109  int AddErrBar(const TFltPrV& XYValV, const TFltV& DeltaYV, const TStr& DatLabel, const TStr& ErrLabel);
110 
111  int AddLinFit(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const TStr& Style=TStr());
112  int AddPwrFit(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const TStr& Style=TStr());
113  int AddPwrFit1(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const TStr& Style=TStr());
114  int AddPwrFit2(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const double& MinX=-1.0, const TStr& Style=TStr());
115  int AddPwrFit3(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const double& MinX=-1.0, const TStr& Style=TStr());
116  int AddPwrFit3(const int& PlotId, const TGpSeriesTy& SeriesTy, const double& MinX, const TStr& Style, double& Intercept, double& Slope, double& R2);
117  int AddLogFit(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const TStr& Style=TStr());
118  int AddExpFit(const int& PlotId, const TGpSeriesTy& SeriesTy=gpwLines, const double& FitXOffset=0.0, const TStr& Style=TStr());
119 
120  void SavePng(const int& SizeX=1000, const int& SizeY=800, const TStr& Comment=TStr()) {
121  SavePng(PlotFNm.GetFPath()+PlotFNm.GetFMid()+".png", SizeX, SizeY, Comment); }
122  void SavePng(const TStr& FNm, const int& SizeX=1000, const int& SizeY=800, const TStr& Comment=TStr(), const TStr& Terminal=TStr());
123  void SaveEps(const int& FontSz=30, const TStr& Comment=TStr()) {
124  SaveEps(PlotFNm.GetFPath()+PlotFNm.GetFMid()+".eps", FontSz, Comment); }
125  void SaveEps(const TStr& FNm, const int& FontSz=30, const TStr& Comment=TStr());
126  void Plot(const TStr& Comment=TStr()) { CreatePlotFile(Comment); RunGnuPlot(); }
127 
128  static void MakeExpBins(const TFltPrV& XYValV, TFltPrV& ExpXYValV,
129  const double& BinFactor = 2, const double& MinYVal = 1);
130  static void MakeExpBins(const TFltKdV& XYValV, TFltKdV& ExpXYValV,
131  const double& BinFactor = 2, const double& MinYVal = 1);
132  static void LoadTs(const TStr& FNm, TStrV& ColNmV, TVec<TFltKdV>& ColV);
133 
134  static TStr GetScaleStr(const TGpScaleTy& ScaleTy);
135  static TStr GetSeriesTyStr(const TGpSeriesTy& SeriesTy);
136 
137  // save tab separated
138  static void SaveTs(const TIntKdV& KdV, const TStr& FNm, const TStr& HeadLn = TStr());
139  static void SaveTs(const TIntFltKdV& KdV, const TStr& FNm, const TStr& HeadLn = TStr());
140  template <class TVal1, class TVal2>
141  static void SaveTs(const TVec<TPair<TVal1, TVal2> >& ValV, const TStr& FNm, const TStr& HeadLn = TStr());
142  template <class TVal1, class TVal2, class TVal3>
143  static void SaveTs(const TVec<TTriple<TVal1, TVal2, TVal3> >& ValV, const TStr& FNm, const TStr& HeadLn = TStr());
144  template <class TVal, int Vals>
145  static void SaveTs(const TVec<TTuple<TVal, Vals> >& ValV, const TStr& FNm, const TStr& HeadLn = TStr());
146  static void Test();
147 
148  // plot value-count tables, and pair vectors
149  template <class TVal1, class TVal2>
150  static void PlotValV(const TVec<TPair<TVal1, TVal2> >& ValV, const TStr& OutFNmPref, const TStr& Desc="",
151  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const bool& PowerFit=false,
152  const TGpSeriesTy& SeriesTy=gpwLinesPoints);
153  template <class TVal1, class TVal2, class TVal3>
154  static void PlotValV(const TVec<TTriple<TVal1, TVal2, TVal3> >& ValV, const TStr& OutFNmPref, const TStr& Desc="",
155  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const bool& PowerFit=false,
156  const TGpSeriesTy& SeriesTy=gpwLinesPoints, const TStr& ErrBarStr = "");
157  template <class TVal1, class TVal2>
158  static void PlotValV(const TVec<TPair<TVal1, TVal2> >& ValV1, const TStr& Name1,
159  const TVec<TPair<TVal1, TVal2> >& ValV2, const TStr& Name2, const TStr& OutFNmPref, const TStr& Desc="",
160  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const bool& PowerFit=false,
161  const TGpSeriesTy& SeriesTy=gpwLinesPoints);
162  template <class TVal1>
163  static void PlotValV(const TVec<TVal1>& ValV, const TStr& OutFNmPref, const TStr& Desc="",
164  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const bool& PowerFit=false,
165  const TGpSeriesTy& SeriesTy=gpwLinesPoints);
166  template <class TKey, class TVal, class THashFunc>
167  static void PlotValCntH(const THash<TKey, TVal, THashFunc>& ValCntH, const TStr& OutFNmPref, const TStr& Desc="",
168  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const bool& PowerFit=false,
169  const TGpSeriesTy& SeriesTy=gpwLinesPoints, const bool& PlotNCDF=false, const bool& ExpBucket=false);
170  template <class TKey, class TVal, class THashFunc>
171  static void PlotValCntH(const THash<TKey, TVal, THashFunc>& ValCntH1, const TStr& Label1,
172  const THash<TKey, TVal, THashFunc>& ValCntH2, const TStr& Label2,
173  const TStr& OutFNmPref, const TStr& Desc, const TStr& XLabel, const TStr& YLabel,
174  const TGpScaleTy& ScaleTy=gpsAuto, const TGpSeriesTy& SeriesTy=gpwLinesPoints);
175  template <class TKey, class TVal, class THashFunc>
176  static void PlotValCntH(const THash<TKey, TVal, THashFunc>& ValCntH1, const TStr& Label1,
177  const THash<TKey, TVal, THashFunc>& ValCntH2, const TStr& Label2,
178  const THash<TKey, TVal, THashFunc>& ValCntH3, const TStr& Label3,
179  const TStr& OutFNmPref, const TStr& Desc, const TStr& XLabel, const TStr& YLabel,
180  const TGpScaleTy& ScaleTy=gpsAuto, const TGpSeriesTy& SeriesTy=gpwLinesPoints);
181  template <class TVal1>
182  static void PlotValMomH(const THash<TVal1, TMom>& ValMomH, const TStr& OutFNmPref, const TStr& Desc="",
183  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const TGpSeriesTy& SeriesTy=gpwLinesPoints,
184  bool PlotAvg=true, bool PlotMed=true, bool PlotMin=false, bool PlotMax=false, bool PlotSDev=false, bool PlotStdErr=true, bool PlotScatter=false);
185  template <class TVal1>
186  static void PlotValMomH(const THash<TVal1, TMom>& ValMomH1, const TStr& Label1, const THash<TVal1, TMom>& ValMomH2, const TStr& Label2,
187  const TStr& OutFNmPref, const TStr& Desc="",
188  const TStr& XLabel="", const TStr& YLabel="", const TGpScaleTy& ScaleTy=gpsAuto, const TGpSeriesTy& SeriesTy=gpwLinesPoints,
189  bool PlotAvg=true, bool PlotMed=true, bool PlotMin=false, bool PlotMax=false, bool PlotSDev=false, bool PlotStdErr=true, bool PlotScatter=false);
190 };
191 
192 //---------------------------------------------------------
193 // useful commands
194 // set terminal png small size 800,600
195 // set terminal postscript enhanced eps 22
196 // set output 'hopsasa.png'
197 // set size 1,0.5
198 // set pointsize 0.9
199 // set key right bottom Left
200 // set style fill solid 0.2
201 // set ticscale 3 1 # longer axis tics
202 // plot ... with points pointtype 6 pointsize 1
203 // 1 + 7 (f) circle
204 // 2 cross 8 (o) triangle
205 // 3 * 9 (f) triangle
206 // 4 (o) square 10 (o) inverse-triangle
207 // 5 (f) square 11 (f) inverse-triangle
208 // 6 (o) circle 12 (o) diamond
209 // 13 (f) diamond
210 // set label "Text" at 23,47000
211 // set arrow from 28,45000 to 28,31000 lw 3
212 // axes x1y2: http://t16web.lanl.gov/Kawano/gnuplot/plot1-e.html#5.2
213 
214 template <class TVal1, class TVal2>
215 void TGnuPlot::SaveTs(const TVec<TPair<TVal1, TVal2> >& ValV, const TStr& FNm, const TStr& HeadLn) {
216  FILE *F = fopen(FNm.CStr(), "wt");
217  EAssert(F);
218  if (! HeadLn.Empty()) { fprintf(F, "# %s\n", HeadLn.CStr()); }
219  for (int i = 0; i < ValV.Len(); i++) {
220  fprintf(F, "%g\t%g\n", double(ValV[i].Val1), double(ValV[i].Val2)); }
221  fclose(F);
222 }
223 
224 template <class TVal1, class TVal2, class TVal3>
225 void TGnuPlot::SaveTs(const TVec<TTriple<TVal1, TVal2, TVal3> >& ValV, const TStr& FNm, const TStr& HeadLn) {
226  FILE *F = fopen(FNm.CStr(), "wt");
227  EAssert(F);
228  if (! HeadLn.Empty()) { fprintf(F, "# %s\n", HeadLn.CStr()); }
229  for (int i = 0; i < ValV.Len(); i++) {
230  fprintf(F, "%g\t%g\t%g\n", double(ValV[i].Val1), double(ValV[i].Val2), double(ValV[i].Val3)); }
231  fclose(F);
232 }
233 
234 template <class TVal, int Vals>
235 void TGnuPlot::SaveTs(const TVec<TTuple<TVal, Vals> >& ValV, const TStr& FNm, const TStr& HeadLn) {
236  FILE *F = fopen(FNm.CStr(), "wt");
237  EAssert(F);
238  if (! HeadLn.Empty()) { fprintf(F, "# %s\n", HeadLn.CStr()); }
239  for (int i = 0; i < ValV.Len(); i++) {
240  fprintf(F, "%g", double(ValV[i][0]));
241  for (int v = 1; v < Vals; v++) {
242  fprintf(F, "\t%g", double(ValV[i][v])); }
243  fprintf(F, "\n");
244  }
245  fclose(F);
246 }
247 
248 template<class TKey, class TDat, class THashFunc>
249 int TGnuPlot::AddPlot(const THash<TKey, TDat, THashFunc>& XYValH, const TGpSeriesTy& SeriesTy, const TStr& Label, const TStr& Style, const bool& ExpBucket) {
250  TFltPrV XYFltValV(XYValH.Len(), 0);
251  for (int k = XYValH.FFirstKeyId(); XYValH.FNextKeyId(k); ) {
252  XYFltValV.Add(TFltPr(TFlt(XYValH.GetKey(k)), TFlt(XYValH[k])));
253  }
254  XYFltValV.Sort();
255  if (ExpBucket) {
256  TFltPrV BucketV;
257  TGnuPlot::MakeExpBins(XYFltValV, BucketV);
258  BucketV.Swap(XYFltValV);
259  }
260  return AddPlot(XYFltValV, SeriesTy, Label, Style);
261 }
262 
263 template<class TKey, class THashFunc>
264 int TGnuPlot::AddPlot(const THash<TKey, TMom, THashFunc>& ValMomH, const TGpSeriesTy& SeriesTy, const TStr& Label, const TStr& Style, bool PlotAvg, bool PlotMed, bool PlotMin, bool PlotMax, bool PlotSDev, bool PlotStdErr, const bool& ExpBucket) {
265  TFltTrV AvgV, StdErrV;
266  TFltPrV AvgV2, MedV, MinV, MaxV, BucketV;
267  for (int i = ValMomH.FFirstKeyId(); ValMomH.FNextKeyId(i); ) {
268  TMom Mom(ValMomH[i]);
269  if (! Mom.IsDef()) { Mom.Def(); }
270  const double x = ValMomH.GetKey(i);
271  if (PlotAvg) {
272  if (PlotSDev) {
273  AvgV.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev())); } // std deviation
274  else if (PlotStdErr) {
275  StdErrV.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev()/sqrt((double)Mom.GetVals())));
276  } else {
277  AvgV2.Add(TFltPr(x, Mom.GetMean()));
278  }
279  }
280  if (PlotMed) { MedV.Add(TFltPr(x, Mom.GetMedian())); }
281  if (PlotMin) { MinV.Add(TFltPr(x, Mom.GetMn())); }
282  if (PlotMax) { MaxV.Add(TFltPr(x, Mom.GetMx())); }
283  }
284  AvgV.Sort(); AvgV2.Sort();
285  MedV.Sort(); MinV.Sort(); MaxV.Sort();
286  int PlotId=0;
287  // exponential bucketing
288  if (ExpBucket) {
289  if (! AvgV2.Empty()) { TGnuPlot::MakeExpBins(AvgV2, BucketV); BucketV.Swap(AvgV2); }
290  if (! MedV.Empty()) { TGnuPlot::MakeExpBins(MedV, BucketV); BucketV.Swap(MedV); }
291  if (! MinV.Empty()) { TGnuPlot::MakeExpBins(MinV, BucketV); BucketV.Swap(MinV); }
292  if (! MaxV.Empty()) { TGnuPlot::MakeExpBins(MaxV, BucketV); BucketV.Swap(MaxV); }
293  }
294  // plot
295  if (! AvgV.Empty()) { PlotId = AddErrBar(AvgV, Label+" Average", Label+" StdDev"); }
296  if (! AvgV2.Empty()) { PlotId = AddPlot(AvgV2, SeriesTy, Label+" Average", Style); }
297  if (! MedV.Empty()) { PlotId = AddPlot(MedV, SeriesTy, Label+" Median", Style); }
298  if (! MinV.Empty()) { PlotId = AddPlot(MinV, SeriesTy, Label+" Min", Style); }
299  if (! MaxV.Empty()) { PlotId = AddPlot(MaxV, SeriesTy, Label+" Max", Style); }
300  if (! StdErrV.Empty()) { PlotId = AddErrBar(StdErrV, Label+" Average", Label+" StdErr"); }
301  return PlotId;
302 }
303 
304 // plot value-count tables, and pair vectors
305 template <class TKey, class TVal, class THashFunc>
306 void TGnuPlot::PlotValCntH(const THash<TKey, TVal, THashFunc>& ValCntH, const TStr& OutFNmPref, const TStr& Desc,
307  const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const bool& PowerFit, const TGpSeriesTy& SeriesTy,
308  const bool& PlotNCDF, const bool& ExpBucket) {
309  TFltPrV IdCntV(ValCntH.Len(), 0), BucketV;
310  for (int i = ValCntH.FFirstKeyId(); ValCntH.FNextKeyId(i); ) {
311  IdCntV.Add(TFltPr(double(ValCntH.GetKey(i)), double(ValCntH[i]))); }
312  IdCntV.Sort();
313  if (ExpBucket) {
314  TGnuPlot::MakeExpBins(IdCntV, BucketV);
315  BucketV.Swap(IdCntV);
316  }
317  if (PlotNCDF) {
318  TFltPrV NCdfV = IdCntV;
319  for (int i = NCdfV.Len()-2; i >= 0; i--) {
320  NCdfV[i].Val2 = NCdfV[i].Val2 + NCdfV[i+1].Val2;
321  }
322  PlotValV(NCdfV, OutFNmPref, Desc, "NCDF "+XLabel, "NCDF "+YLabel, ScaleTy, PowerFit, SeriesTy);
323  } else {
324  PlotValV(IdCntV, OutFNmPref, Desc, XLabel, YLabel, ScaleTy, PowerFit, SeriesTy);
325  }
326 }
327 
328 template <class TKey, class TVal, class THashFunc>
329 void TGnuPlot::PlotValCntH(const THash<TKey, TVal, THashFunc>& ValCntH1, const TStr& Label1,
330  const THash<TKey, TVal, THashFunc>& ValCntH2, const TStr& Label2,
331  const TStr& OutFNmPref, const TStr& Desc, const TStr& XLabel, const TStr& YLabel,
332  const TGpScaleTy& ScaleTy, const TGpSeriesTy& SeriesTy) {
333  PlotValCntH(ValCntH1, Label1, ValCntH2, Label2, THash<TKey, TVal, THashFunc>(), "", OutFNmPref, Desc, XLabel, YLabel,
334  ScaleTy, SeriesTy);
335 }
336 
337 template <class TKey, class TVal, class THashFunc>
338 void TGnuPlot::PlotValCntH(const THash<TKey, TVal, THashFunc>& ValCntH1, const TStr& Label1,
339  const THash<TKey, TVal, THashFunc>& ValCntH2, const TStr& Label2,
340  const THash<TKey, TVal, THashFunc>& ValCntH3, const TStr& Label3,
341  const TStr& OutFNmPref, const TStr& Desc, const TStr& XLabel, const TStr& YLabel,
342  const TGpScaleTy& ScaleTy, const TGpSeriesTy& SeriesTy) {
343  TFltPrV IdCntV1(ValCntH1.Len(), 0), IdCntV2(ValCntH2.Len(), 0), IdCntV3(ValCntH3.Len(), 0);
344  for (int i = ValCntH1.FFirstKeyId(); ValCntH1.FNextKeyId(i); ) {
345  IdCntV1.Add(TFltPr(double(ValCntH1.GetKey(i)), double(ValCntH1[i]))); }
346  for (int i = ValCntH2.FFirstKeyId(); ValCntH2.FNextKeyId(i); ) {
347  IdCntV2.Add(TFltPr(double(ValCntH2.GetKey(i)), double(ValCntH2[i]))); }
348  for (int i = ValCntH3.FFirstKeyId(); ValCntH3.FNextKeyId(i); ) {
349  IdCntV3.Add(TFltPr(double(ValCntH3.GetKey(i)), double(ValCntH3[i]))); }
350  IdCntV1.Sort();
351  IdCntV2.Sort();
352  IdCntV3.Sort();
353  TGnuPlot GP(OutFNmPref, Desc);
354  GP.SetXYLabel(XLabel, YLabel);
355  GP.SetScale(ScaleTy);
356  if (! IdCntV1.Empty()) { GP.AddPlot(IdCntV1, SeriesTy, Label1); }
357  if (! IdCntV2.Empty()) { GP.AddPlot(IdCntV2, SeriesTy, Label2); }
358  if (! IdCntV3.Empty()) { GP.AddPlot(IdCntV3, SeriesTy, Label3); }
359  GP.SavePng();
360 }
361 
362 template <class TVal1, class TVal2>
363 void TGnuPlot::PlotValV(const TVec<TPair<TVal1, TVal2> >& ValV, const TStr& OutFNmPref, const TStr& Desc,
364  const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const bool& PowerFit, const TGpSeriesTy& SeriesTy) {
365  TFltKdV IdCntV(ValV.Len(), 0);
366  for (int i = 0; i < ValV.Len(); i++) {
367  IdCntV.Add(TFltKd(double(ValV[i].Val1), double(ValV[i].Val2))); }
368  if (IdCntV.Empty()) { printf("*** Empty plot %s\n", OutFNmPref.CStr()); return; }
369  IdCntV.Sort();
370  TGnuPlot GP(OutFNmPref, Desc);
371  GP.SetXYLabel(XLabel, YLabel);
372  GP.SetScale(ScaleTy);
373  const int Id = GP.AddPlot(IdCntV, SeriesTy);
374  if (PowerFit) {
375  GP.AddPwrFit3(Id);
376  double MaxY = IdCntV.Last().Dat, MinY = IdCntV[0].Dat;
377  if (MaxY < MinY) { Swap(MaxY, MinY); }
378  //GP.SetYRange(MinY, pow(10.0, floor(log10(MaxY))+1.0));
379  GP.AddCmd(TStr::Fmt("set yrange[%f:]", MinY));
380  }
381  GP.SavePng();
382 }
383 
384 template <class TVal1, class TVal2, class TVal3>
385 void TGnuPlot::PlotValV(const TVec<TTriple<TVal1, TVal2, TVal3> >& ValV, const TStr& OutFNmPref, const TStr& Desc,
386  const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const bool& PowerFit, const TGpSeriesTy& SeriesTy, const TStr& ErrBarStr) {
387  TFltKdV IdCntV(ValV.Len(), 0);
388  TFltV DeltaYV(ValV.Len(), 0);
389  for (int i = 0; i < ValV.Len(); i++) {
390  IdCntV.Add(TFltKd(double(ValV[i].Val1), double(ValV[i].Val2)));
391  DeltaYV.Add(double(ValV[i].Val3));
392  }
393  if (IdCntV.Empty()) { printf("*** Empty plot %s\n", OutFNmPref.CStr()); return; }
394  IdCntV.Sort();
395  TGnuPlot GP(OutFNmPref, Desc);
396  GP.SetXYLabel(XLabel, YLabel);
397  GP.SetScale(ScaleTy);
398  const int Id = GP.AddPlot(IdCntV, SeriesTy);
399  GP.AddErrBar(IdCntV, DeltaYV, ErrBarStr);
400  if (PowerFit) {
401  GP.AddPwrFit3(Id);
402  double MaxY = IdCntV.Last().Dat, MinY = IdCntV[0].Dat;
403  if (MaxY < MinY) { Swap(MaxY, MinY); }
404  //GP.SetYRange(MinY, pow(10.0, floor(log10(MaxY))+1.0));
405  GP.AddCmd(TStr::Fmt("set yrange[%f:]", MinY));
406  }
407  GP.SavePng();
408 }
409 
410 
411 template <class TVal1, class TVal2>
412 void TGnuPlot::PlotValV(const TVec<TPair<TVal1, TVal2> >& ValV1, const TStr& Name1,
413  const TVec<TPair<TVal1, TVal2> >& ValV2, const TStr& Name2, const TStr& OutFNmPref, const TStr& Desc,
414  const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const bool& PowerFit, const TGpSeriesTy& SeriesTy) {
415  TFltKdV IdCntV1(ValV1.Len(), 0), IdCntV2(ValV2.Len(), 0);
416  for (int i = 0; i < ValV1.Len(); i++) {
417  IdCntV1.Add(TFltKd(double(ValV1[i].Val1), double(ValV1[i].Val2))); }
418  for (int i = 0; i < ValV2.Len(); i++) {
419  IdCntV2.Add(TFltKd(double(ValV2[i].Val1), double(ValV2[i].Val2))); }
420  if (IdCntV1.Empty() || IdCntV2.Empty()) { printf("*** Empty plot %s\n", OutFNmPref.CStr()); return; }
421  IdCntV1.Sort();
422  IdCntV2.Sort();
423  TGnuPlot GP(OutFNmPref, Desc);
424  GP.SetXYLabel(XLabel, YLabel);
425  GP.SetScale(ScaleTy);
426  { const int Id = GP.AddPlot(IdCntV1, SeriesTy, Name1);
427  if (PowerFit) {
428  GP.AddPwrFit3(Id);
429  double MaxY = IdCntV1.Last().Dat, MinY = IdCntV1[0].Dat;
430  if (MaxY < MinY) { Swap(MaxY, MinY); }
431  GP.AddCmd(TStr::Fmt("set yrange[%f:]", MinY));
432  } }
433  { const int Id = GP.AddPlot(IdCntV2, SeriesTy, Name2);
434  if (PowerFit) {
435  GP.AddPwrFit3(Id);
436  double MaxY = IdCntV2.Last().Dat, MinY = IdCntV2[0].Dat;
437  if (MaxY < MinY) { Swap(MaxY, MinY); }
438  GP.AddCmd(TStr::Fmt("set yrange[%f:]", MinY));
439  } }
440  GP.SavePng();
441 }
442 
443 
444 
445 template <class TVal1>
446 void TGnuPlot::PlotValV(const TVec<TVal1>& ValV, const TStr& OutFNmPref, const TStr& Desc,
447  const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const bool& PowerFit, const TGpSeriesTy& SeriesTy) {
448  TFltKdV IdCntV(ValV.Len(), 0);
449  for (int i = 0; i < ValV.Len(); i++) {
450  IdCntV.Add(TFltKd(double(i+1), double(ValV[i]))); }
451  if (IdCntV.Empty()) { printf("*** Empty plot %s\n", OutFNmPref.CStr()); return; }
452  IdCntV.Sort();
453  TGnuPlot GP(OutFNmPref, Desc);
454  GP.SetXYLabel(XLabel, YLabel);
455  GP.SetScale(ScaleTy);
456  const int Id = GP.AddPlot(IdCntV, SeriesTy);
457  if (PowerFit) {
458  GP.AddPwrFit3(Id);
459  double MaxY = IdCntV.Last().Dat, MinY = IdCntV[0].Dat;
460  if (MaxY < MinY) { Swap(MaxY, MinY); }
461  //GP.SetYRange(MinY, pow(10.0, floor(log10(MaxY))+1.0));
462  GP.AddCmd(TStr::Fmt("set yrange[%f:]", MinY));
463  }
464  GP.SavePng();
465 }
466 
467 template <class TVal1>
468 void TGnuPlot::PlotValMomH(const THash<TVal1, TMom>& ValMomH, const TStr& OutFNmPref, const TStr& Desc,
469  const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const TGpSeriesTy& SeriesTy,
470  bool PlotAvg, bool PlotMed, bool PlotMin, bool PlotMax, bool PlotSDev, bool PlotStdErr, bool PlotScatter) {
471  TFltTrV AvgV, StdErrV;
472  TFltPrV AvgV2, MedV, MinV, MaxV;
473  TFltPrV ScatterV;
474  for (int i = ValMomH.FFirstKeyId(); ValMomH.FNextKeyId(i); ) {
475  TMom Mom(ValMomH[i]);
476  if (! Mom.IsDef()) { Mom.Def(); }
477  const double x = ValMomH.GetKey(i);
478  if (PlotAvg) {
479  if (PlotSDev) {
480  AvgV.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev())); } // std deviation
481  else {
482  AvgV2.Add(TFltPr(x, Mom.GetMean()));
483  }
484  if (PlotStdErr) {
485  StdErrV.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev()/sqrt((double)Mom.GetVals())));
486  }
487  }
488  if (PlotMed) { MedV.Add(TFltPr(x, Mom.GetMedian())); }
489  if (PlotMin) { MinV.Add(TFltPr(x, Mom.GetMn())); }
490  if (PlotMax) { MaxV.Add(TFltPr(x, Mom.GetMx())); }
491  if (PlotScatter) {
492  THashSet<TFlt> PointSet;
493  for (int xi = 0; xi < ValMomH[i].GetVals(); xi++) {
494  PointSet.AddKey(ValMomH[i].GetVal(xi)); }
495  //ScatterV.Add(TFltPr(x, ValMomH[i].GetVal(xi))); }
496  for (int xi = 0; xi < PointSet.Len(); xi++) {
497  ScatterV.Add(TFltPr(x, PointSet[xi])); }
498  //printf("S%d %d %d.", ValMomH[i].GetVals(), PointSet.Len(), ScatterV.Len());
499  }
500  }
501  AvgV.Sort(); AvgV2.Sort();
502  MedV.Sort(); MinV.Sort(); MaxV.Sort(); StdErrV.Sort();
503  TGnuPlot GP(OutFNmPref, Desc);
504  GP.SetScale(ScaleTy);
505  GP.SetXYLabel(XLabel, YLabel);
506  if (! ScatterV.Empty()) { GP.AddPlot(ScatterV, gpwPoints, "Scatter"); }
507  if (! AvgV.Empty()) { GP.AddErrBar(AvgV, "Average", "StdDev"); }
508  if (! AvgV2.Empty()) { GP.AddPlot(AvgV2, SeriesTy, "Average"); }
509  if (! MedV.Empty()) { GP.AddPlot(MedV, SeriesTy, "Median"); }
510  if (! MinV.Empty()) { GP.AddPlot(MinV, SeriesTy, "Min"); }
511  if (! MaxV.Empty()) { GP.AddPlot(MaxV, SeriesTy, "Max"); }
512  if (! StdErrV.Empty()) { GP.AddErrBar(StdErrV, "Standard error"); }
513  GP.SavePng();
514 }
515 
516 template <class TVal1>
517 void TGnuPlot::PlotValMomH(const THash<TVal1, TMom>& ValMomH1, const TStr& Label1, const THash<TVal1, TMom>& ValMomH2, const TStr& Label2,
518  const TStr& OutFNmPref, const TStr& Desc, const TStr& XLabel, const TStr& YLabel, const TGpScaleTy& ScaleTy, const TGpSeriesTy& SeriesTy,
519  bool PlotAvg, bool PlotMed, bool PlotMin, bool PlotMax, bool PlotSDev, bool PlotStdErr, bool PlotScatter) {
520  TFltTrV AvgV1, AvgV2, StdErrV1, StdErrV2;
521  TFltPrV AvgVM1, MedV1, MinV1, MaxV1;
522  TFltPrV AvgVM2, MedV2, MinV2, MaxV2;
523  TFltPrV ScatterV1, ScatterV2;
524  // ValMom1
525  for (int i = ValMomH1.FFirstKeyId(); ValMomH1.FNextKeyId(i); ) {
526  TMom Mom(ValMomH1[i]);
527  if (! Mom.IsDef()) { Mom.Def(); }
528  const double x = ValMomH1.GetKey(i);
529  if (PlotAvg) {
530  if (PlotSDev) {
531  AvgV1.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev())); } // std deviation
532  else {
533  AvgVM1.Add(TFltPr(x, Mom.GetMean()));
534  }
535  if (PlotStdErr) {
536  StdErrV1.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev()/sqrt((double)Mom.GetVals())));
537  }
538  }
539  if (PlotMed) { MedV1.Add(TFltPr(x, Mom.GetMedian())); }
540  if (PlotMin) { MinV1.Add(TFltPr(x, Mom.GetMn())); }
541  if (PlotMax) { MaxV1.Add(TFltPr(x, Mom.GetMx())); }
542  if (PlotScatter) {
543  THashSet<TFlt> PointSet;
544  for (int xi = 0; xi < ValMomH1[i].GetVals(); xi++) {
545  PointSet.AddKey(ValMomH1[i].GetVal(xi)); }
546  for (int xi = 0; xi < PointSet.Len(); xi++) {
547  ScatterV1.Add(TFltPr(x, PointSet[xi])); }
548  }
549  }
550  AvgV1.Sort(); AvgVM1.Sort(); MedV1.Sort(); MinV1.Sort(); MaxV1.Sort(); StdErrV1.Sort();
551  // ValMom2
552  for (int i = ValMomH2.FFirstKeyId(); ValMomH2.FNextKeyId(i); ) {
553  TMom Mom(ValMomH2[i]);
554  if (! Mom.IsDef()) { Mom.Def(); }
555  const double x = ValMomH2.GetKey(i);
556  if (PlotAvg) {
557  if (PlotSDev) {
558  AvgV2.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev())); } // std deviation
559  else {
560  AvgVM2.Add(TFltPr(x, Mom.GetMean()));
561  }
562  if (PlotStdErr) {
563  StdErrV2.Add(TFltTr(x, Mom.GetMean(), Mom.GetSDev()/sqrt((double)Mom.GetVals())));
564  }
565  }
566  if (PlotMed) { MedV2.Add(TFltPr(x, Mom.GetMedian())); }
567  if (PlotMin) { MinV2.Add(TFltPr(x, Mom.GetMn())); }
568  if (PlotMax) { MaxV2.Add(TFltPr(x, Mom.GetMx())); }
569  if (PlotScatter) {
570  THashSet<TFlt> PointSet;
571  for (int xi = 0; xi < ValMomH2[i].GetVals(); xi++) {
572  PointSet.AddKey(ValMomH2[i].GetVal(xi)); }
573  for (int xi = 0; xi < PointSet.Len(); xi++) {
574  ScatterV2.Add(TFltPr(x, PointSet[xi])); }
575  }
576  }
577  AvgV2.Sort(); AvgVM2.Sort(); MedV2.Sort(); MinV2.Sort(); MaxV2.Sort(); StdErrV2.Sort();
578  // plot
579  TGnuPlot GP(OutFNmPref, Desc);
580  GP.SetScale(ScaleTy);
581  GP.SetXYLabel(XLabel, YLabel);
582  // ValMom1
583  if (! ScatterV1.Empty()) { GP.AddPlot(ScatterV1, gpwPoints, Label1+": Scatter"); }
584  if (! AvgV1.Empty()) { GP.AddErrBar(AvgV1, Label1+": Average", Label1+": StdDev"); }
585  if (! AvgVM1.Empty()) { GP.AddPlot(AvgVM1, SeriesTy, Label1+": Average"); }
586  if (! MedV1.Empty()) { GP.AddPlot(MedV1, SeriesTy, Label1+": Median"); }
587  if (! MinV1.Empty()) { GP.AddPlot(MinV1, SeriesTy, Label1+": Min"); }
588  if (! MaxV1.Empty()) { GP.AddPlot(MaxV1, SeriesTy, Label1+": Max"); }
589  if (! StdErrV1.Empty()) { GP.AddErrBar(StdErrV1, Label1+": Std error"); }
590  // ValMom2
591  if (! ScatterV2.Empty()) { GP.AddPlot(ScatterV2, gpwPoints, Label2+": Scatter"); }
592  if (! AvgV2.Empty()) { GP.AddErrBar(AvgV2, Label2+": Average", Label2+": StdDev"); }
593  if (! AvgVM2.Empty()) { GP.AddPlot(AvgVM2, SeriesTy, Label2+": Average"); }
594  if (! MedV2.Empty()) { GP.AddPlot(MedV2, SeriesTy, Label2+": Median"); }
595  if (! MinV2.Empty()) { GP.AddPlot(MinV2, SeriesTy, Label2+": Min"); }
596  if (! MaxV2.Empty()) { GP.AddPlot(MaxV2, SeriesTy, Label2+": Max"); }
597  if (! StdErrV2.Empty()) { GP.AddErrBar(StdErrV2, Label2+": Std error"); }
598  GP.SavePng();
599 }
600 
601 #endif
602 
TGnuPlot & operator=(const TGnuPlot &GnuPlot)
Definition: gnuplot.cpp:106
int AddLinFit(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const TStr &Style=TStr())
Definition: gnuplot.cpp:335
TFltPr XRange
Definition: gnuplot.h:53
int AddExpFit(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const double &FitXOffset=0.0, const TStr &Style=TStr())
Definition: gnuplot.cpp:546
void SetLineStyle(const int &PlotId, const TStr &StyleStr)
Definition: gnuplot.h:83
TStr Title
Definition: gnuplot.h:51
TStr GetFMid() const
Definition: dt.cpp:1403
bool operator<(const TGpSeries &Gps) const
Definition: gnuplot.cpp:82
TGpSeriesTy SeriesTy
Definition: gnuplot.h:27
void SetXRange(const double &Min, const double &Max)
Definition: gnuplot.h:79
double GetMedian() const
Definition: xmath.h:244
Definition: ds.h:262
Definition: ds.h:129
static void MakeExpBins(const TFltPrV &XYValV, TFltPrV &ExpXYValV, const double &BinFactor=2, const double &MinYVal=1)
Definition: gnuplot.cpp:610
TStr GetFPath() const
Definition: dt.cpp:1389
void SavePng(const int &SizeX=1000, const int &SizeY=800, const TStr &Comment=TStr())
Definition: gnuplot.h:120
TStr DataFNm
Definition: gnuplot.h:50
int GetVals() const
Definition: xmath.h:220
bool IsDef() const
Definition: xmath.h:214
TGnuPlot(const TStr &FileNm="gplot", const TStr &PlotTitle=TStr(), const bool &Grid=true)
Definition: gnuplot.cpp:86
void SetTitle(const TStr &PlotTitle)
Definition: gnuplot.h:70
void SetYLabel(const TStr &YLabel)
Definition: gnuplot.h:72
TGpSeriesCmp(const TVec< TGpSeries > &_SeriesV)
Definition: gnuplot.h:43
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
bool operator()(const int &Left, const int &Right) const
Definition: gnuplot.h:44
void SetXYLabel(const TStr &XLabel, const TStr &YLabel)
Definition: gnuplot.h:73
static int GetTics42()
Definition: gnuplot.cpp:26
int AddPwrFit3(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const double &MinX=-1.0, const TStr &Style=TStr())
Definition: gnuplot.cpp:463
Definition: xmath.h:129
TKeyDat< TFlt, TFlt > TFltKd
Definition: ds.h:386
void SetDataPlotFNm(const TStr &DatFNm, const TStr &PltFNm)
Definition: gnuplot.h:74
TGpSeries & operator=(const TGpSeries &Gps)
Definition: gnuplot.cpp:70
void Plot(const TStr &Comment=TStr())
Definition: gnuplot.h:126
TStr LblY
Definition: gnuplot.h:51
TVec< TGpSeries > SeriesV
Definition: gnuplot.h:55
void SetYRange(const double &Min, const double &Max)
Definition: gnuplot.h:80
Definition: gnuplot.h:7
double GetSDev() const
Definition: xmath.h:242
int AddPwrFit(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const TStr &Style=TStr())
Definition: gnuplot.cpp:366
Definition: dt.h:1291
bool Empty() const
Tests whether the vector is empty.
Definition: ds.h:530
static void LoadTs(const TStr &FNm, TStrV &ColNmV, TVec< TFltKdV > &ColV)
Definition: gnuplot.cpp:661
static void PlotValMomH(const THash< TVal1, TMom > &ValMomH, const TStr &OutFNmPref, const TStr &Desc="", const TStr &XLabel="", const TStr &YLabel="", const TGpScaleTy &ScaleTy=gpsAuto, const TGpSeriesTy &SeriesTy=gpwLinesPoints, bool PlotAvg=true, bool PlotMed=true, bool PlotMin=false, bool PlotMax=false, bool PlotSDev=false, bool PlotStdErr=true, bool PlotScatter=false)
Definition: gnuplot.h:468
void Swap(TVec< TVal, TSizeTy > &Vec)
Swaps the contents of the vector with Vec.
Definition: ds.h:1011
static void SaveTs(const TIntKdV &KdV, const TStr &FNm, const TStr &HeadLn=TStr())
Definition: gnuplot.cpp:713
void AddCmd(const TStr &Cmd)
Definition: gnuplot.h:81
double GetMx() const
Definition: xmath.h:238
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1218
Definition: gnuplot.h:7
static void PlotValCntH(const THash< TKey, TVal, THashFunc > &ValCntH, const TStr &OutFNmPref, const TStr &Desc="", const TStr &XLabel="", const TStr &YLabel="", const TGpScaleTy &ScaleTy=gpsAuto, const bool &PowerFit=false, const TGpSeriesTy &SeriesTy=gpwLinesPoints, const bool &PlotNCDF=false, const bool &ExpBucket=false)
Definition: gnuplot.h:306
TStr GetLineStyle(const int &PlotId) const
Definition: gnuplot.h:82
TFltKdV XYValV
Definition: gnuplot.h:28
static TStr GetSeriesTyStr(const TGpSeriesTy &SeriesTy)
Definition: gnuplot.cpp:695
const TVec< TGpSeries > & SeriesV
Definition: gnuplot.h:41
bool FNextKeyId(int &KeyId) const
Definition: hash.h:432
bool SetPause
Definition: gnuplot.h:54
int AddLogFit(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const TStr &Style=TStr())
Definition: gnuplot.cpp:515
bool SetGrid
Definition: gnuplot.h:54
void Pause(const bool &DoPause)
Definition: gnuplot.h:77
int AddKey(const TKey &Key)
Definition: shash.h:1254
int FFirstKeyId() const
Definition: hash.h:232
TTriple< TFlt, TFlt, TFlt > TFltTr
Definition: ds.h:175
bool SaveXVals() const
Definition: gnuplot.h:37
TPair< TFlt, TFlt > TFltPr
Definition: ds.h:99
void SaveEps(const int &FontSz=30, const TStr &Comment=TStr())
Definition: gnuplot.h:123
TGpScaleTy ScaleTy
Definition: gnuplot.h:52
int AddPwrFit2(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const double &MinX=-1.0, const TStr &Style=TStr())
Definition: gnuplot.cpp:415
#define EAssert(Cond)
Definition: bd.h:280
int Len() const
Definition: shash.h:1121
TStr LblX
Definition: gnuplot.h:51
int IsSameXCol(const int &CurId, const int &PrevId) const
Definition: gnuplot.cpp:754
Definition: gnuplot.h:13
void SetScale(const TGpScaleTy &GpScaleTy)
Definition: gnuplot.h:78
double GetMean() const
Definition: xmath.h:240
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488
static void PlotValV(const TVec< TPair< TVal1, TVal2 > > &ValV, const TStr &OutFNmPref, const TStr &Desc="", const TStr &XLabel="", const TStr &YLabel="", const TGpScaleTy &ScaleTy=gpsAuto, const bool &PowerFit=false, const TGpSeriesTy &SeriesTy=gpwLinesPoints)
Definition: gnuplot.h:363
static TStr DefDataFNm
Definition: gnuplot.h:23
static TStr Fmt(const char *FmtStr,...)
Definition: dt.cpp:1599
Definition: hash.h:88
static TStr GnuPlotPath
Path to GnuPlot executable. Set if gnuplot is not found in the PATH.
Definition: gnuplot.h:19
TFltPr YRange
Definition: gnuplot.h:53
int AddPlot(const TIntV &YValV, const TGpSeriesTy &SeriesTy=gpwLinesPoints, const TStr &Label=TStr(), const TStr &Style=TStr())
Definition: gnuplot.cpp:182
static TStr DefPlotFNm
Definition: gnuplot.h:22
static void Test()
Definition: gnuplot.cpp:732
void ShowGrid(const bool &Show)
Definition: gnuplot.h:76
static TStr GetScaleStr(const TGpScaleTy &ScaleTy)
Definition: gnuplot.cpp:679
int AddPwrFit1(const int &PlotId, const TGpSeriesTy &SeriesTy=gpwLines, const TStr &Style=TStr())
Definition: gnuplot.cpp:373
int AddErrBar(const TFltTrV &XYDValV, const TStr &Label=TStr())
Definition: gnuplot.cpp:261
char * CStr()
Definition: dt.h:476
TStr GetSeriesPlotStr(const int &PlotN)
Definition: gnuplot.cpp:124
void RunGnuPlot() const
Definition: gnuplot.cpp:869
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
static TStr GnuPlotFNm
GnuPlot executable file name. Set if different than the standard wgnuplot/gnuplot.
Definition: gnuplot.h:21
TStr PlotFNm
Definition: gnuplot.h:50
TGpScaleTy
Definition: gnuplot.h:6
int Len() const
Definition: hash.h:186
static int Tics42
Definition: gnuplot.h:48
void CreatePlotFile(const TStr &Comment=TStr())
Definition: gnuplot.cpp:764
TGpSeriesTy
Definition: gnuplot.h:11
int AddFunc(const TStr &FuncStr, const TGpSeriesTy &SeriesTy=gpwLinesPoints, const TStr &Label=TStr(), const TStr &Style=TStr())
Definition: gnuplot.cpp:151
void SetXLabel(const TStr &XLabel)
Definition: gnuplot.h:71
TStrV MoreCmds
Definition: gnuplot.h:56
double GetMn() const
Definition: xmath.h:237
void Def()
Definition: xmath.cpp:339
const TKey & GetKey(const int &KeyId) const
Definition: hash.h:210
void Swap(TRec &Rec1, TRec &Rec2)
Definition: bd.h:568