JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
|
This group contains a statistics library, which offers several basic methods and is based on an iterator interface:
In addition there is a set of "adaptors" (see Statistics To Plot Adaptors ) that shortcut the calculation of a statistical property and the subsequent parametrization of a plot with the results. With these adaptors you can add e.g. a boxplot or histogram chart to a plot by calling only one function.
All statistics functions use an iterator-based interface, comparable to the interface of the algorithms in the C++ standard template library. To this end, the class JKQTPDatastore
provides an iterator interface to its columns, using the functions JKQTPDatastore::begin()
and JKQTPDatastore::end()
. Both functions simply receive the column ID as parameter and exist in a const and a mutable variant. the latter allows to also edit the data. In addition the function JKQTPDatastore::backInserter()
returns a back-inserter iterator (like generated for STL containers with std::back_inserter(container)
) that also allows to append to the column.
Note that the iterator interface allows to use these functions with any container that provides such iterators (e.g. std::vector<double>
, std::list<int>
, std::set<float>
, QVector<double>
...).
Code using one of these statistics functions therefore may look e.g. like this:
All statistics functions use all values in the given range and convert each value to a double
, using jkqtp_todouble()
. The return values is always a dohble. Therefore you can use these functions to calculate statistics of ranges of any type that can be converted to double
. Values that do not result in a valid double
are not used in calculating the statistics. Therefore you can exclude values by setting them JKQTP_DOUBLE_NAN
(i.e. "not a number").