Lumiera  0.pre.03
»edit your freedom«
gnuplot-gen.hpp
Go to the documentation of this file.
1 /*
2  GNUPLOT-GEN.hpp - setup for simplified data visualisation via Gnuplot
3 
4  Copyright (C) Lumiera.org
5  2024, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
48 #ifndef LIB_GNUPLOT_GEN_H
49 #define LIB_GNUPLOT_GEN_H
50 
51 
52 #include "lib/stat/csv.hpp"
53 #include "lib/format-util.hpp"
54 #include "lib/diff/gen-node.hpp"
55 
56 #include <string>
57 #include <vector>
58 #include <tuple>
59 
60 using std::string;
61 
62 namespace lib {
63 namespace gnuplot_gen {
64 
65 
66 
68 
69  const string KEY_CSVData = "CSVData";
70  const string KEY_DiagramKind = "DiagramKind";
71 
72  const string KEY_Term = "Term";
73  const string KEY_TermSize = "TermSize";
74 
75  const string KEY_Xtics = "Xtics";
76  const string KEY_Xrange = "Xrange";
77  const string KEY_Yrange = "Yrange";
78  const string KEY_Y2range = "Y2range";
79  const string KEY_Y3range = "Y3range";
80  const string KEY_Xlabel = "Xlabel";
81  const string KEY_Ylabel = "Ylabel";
82  const string KEY_Y2label = "Y2label";
83  const string KEY_Y3label = "Y3label";
84 
85  const string KEY_RegrSocket = "RegrSocket";
86  const string KEY_RegrSlope = "RegrSlope";
87 
88 
89 
93  string dataPlot (ParamRecord);
94 
95  inline string
96  dataPlot (string csvData)
97  {
98  return dataPlot (ParamRecord().set (KEY_CSVData, csvData));
99  }
100 
101 
106 
107  inline string
108  scatterRegression (string csvData)
109  {
110  return scatterRegression (ParamRecord().set (KEY_CSVData, csvData));
111  }
112 
113 
114 }} // namespace lib::gnuplot_gen
115 #endif /*LIB_GNUPLOT_GEN_H*/
Encoding and decoding of data into CSV format.
string scatterRegression(ParamRecord params)
Generate a (X,Y)-scatter plot with regression line.
string dataPlot(ParamRecord params)
Generate a Gnuplot diagram to visualise the given data points.
Implementation namespace for support and library code.
Generic building block for tree shaped (meta)data structures.
Collection of small helpers and convenience shortcuts for diagnostics & formatting.