From ff489e9fac11944945633207bbd4a273750a65ee Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Wed, 29 May 2019 22:47:26 +0200 Subject: [PATCH] bugfixes --- README.md | 2 + doc/dox/examples_and_tutorials.dox | 2 +- examples/README.md | 2 +- examples/jkqtplot_test/jkqtplot_test.pro | 1 + .../simpletest/jkqtplotter_simpletest.pro | 1 + ..._simpletest_advancedlineandfillstyling.pro | 2 + .../jkqtplotter_simpletest_datastore.pro | 1 + .../simpletest_datastore_statistics/README.md | 18 +- ...lotter_simpletest_datastore_statistics.cpp | 2 +- ...lotter_simpletest_datastore_statistics.pro | 1 + .../jkqtplotter_simpletest_functionplot.pro | 1 + ...otter_simpletest_imageplot_nodatastore.pro | 2 + .../jkqtplotter_simpletest_impulsesplot.pro | 1 + ...jkqtplotter_simpletest_parametriccurve.pro | 1 + ...kqtplotter_simpletest_paramscatterplot.pro | 1 + ...tter_simpletest_paramscatterplot_image.pro | 1 + .../simpletest_parsedfunctionplot/README.md | 13 +- ...tplotter_simpletest_parsedfunctionplot.pro | 1 + .../jkqtplotter_simpletest_speed.pro | 1 + ...tplotter_simpletest_symbols_and_errors.pro | 1 + ...tplotter_simpletest_symbols_and_styles.pro | 1 + examples/simpletest_ui/README.md | 7 +- .../jkqtplotter_simpletest_ui.pro | 1 + examples/test_multiplot/test_multiplot.pro | 2 + examples/test_styling/README.md | 12 +- examples/test_styling/test_styling.pro | 2 + .../test_user_interaction.pro | 2 + lib/jkqtcommon/jkqtpmathparser.cpp | 1 + lib/jkqtcommon/jkqtpmathtools.h | 1 + lib/jkqtcommon/jkqtpstatisticstools.h | 385 +++++++++++++++++- lib/jkqtpcommon.pri | 2 + lib/jkqtplotter/jkqtpdatastorage.cpp | 6 +- lib/jkqtplotter/jkqtpdatastorage.h | 325 ++++++++------- .../jkqtpgraphsstatisticsadaptors.h | 28 +- 34 files changed, 621 insertions(+), 209 deletions(-) diff --git a/README.md b/README.md index 73caabc0e4..1dc310442a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ This software is licensed under the term of the [GNU Lesser General Public Licen - external or internal datasets - complete with GUI (table view) - export capabilities (e.g. to CSV, SYLK, ...) + - C++ standard iterator interface + - statistics library - large variety of graphs that can be added to a plot, e.g.: - scatter-plots (also parametrized color/size/symbol by a third data-column) - line graphs, step graphs, impulses diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index e3571b09a1..f4a078c461 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -153,7 +153,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html simpletest_datastore_small.png \subpage JKQTPlotterBasicJKQTPDatastore Basic Data Management with JKQTPDatastore
Copying data into a JKQTPDatastore
Editing data inside a JKQTPDatastore
Editing Image Data in a JKQTPDatastore - \image html simpletest_datastore_statistics_small.png + \image html jkqtplotter_simpletest_datastore_statistics_small.png \subpage JKQTPlotterBasicJKQTPDatastoreStatistics Advanced 1-Dimensional Statistical Computation with JKQTPODatastore (and the internal statistics library, see \ref jkqtptools_math_statistics ) diff --git a/examples/README.md b/examples/README.md index 37c2b96767..237f0a83e7 100644 --- a/examples/README.md +++ b/examples/README.md @@ -64,7 +64,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int | Screenshot | Description | Notes | |:-------------:| ------------- | ------------- | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/simpletest_datastore_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore) | [Tutorial: Basic Usage of JKQTPDatastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore) | Basic Data Management with JKQTPDatastore
Copying data into a JKQTPDatastore
Editing data inside a JKQTPDatastore
Editing Image Data in a JKQTPDatastore | -| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/simpletest_datastore_statistics_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | [Tutorial: Advanced 1-Dimensional Statistics with JKQTPDatastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | Advanced 1-Dimensional Statistical Computation with JKQTPDatastore (and the internal statistics library) | +| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_datastore_statistics_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | [Tutorial: Advanced 1-Dimensional Statistics with JKQTPDatastore](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics) | Advanced 1-Dimensional Statistical Computation with JKQTPDatastore (and the internal statistics library) | ## More Complex Examples diff --git a/examples/jkqtplot_test/jkqtplot_test.pro b/examples/jkqtplot_test/jkqtplot_test.pro index 0c4ba4db0e..e63344177c 100644 --- a/examples/jkqtplot_test/jkqtplot_test.pro +++ b/examples/jkqtplot_test/jkqtplot_test.pro @@ -49,6 +49,7 @@ RESOURCES += jkqtplot_test.qrc win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX TARGET = jkqtplot_test diff --git a/examples/simpletest/jkqtplotter_simpletest.pro b/examples/simpletest/jkqtplotter_simpletest.pro index f71a8205c7..4c7925a21a 100644 --- a/examples/simpletest/jkqtplotter_simpletest.pro +++ b/examples/simpletest/jkqtplotter_simpletest.pro @@ -20,6 +20,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_advancedlineandfillstyling/jkqtplotter_simpletest_advancedlineandfillstyling.pro b/examples/simpletest_advancedlineandfillstyling/jkqtplotter_simpletest_advancedlineandfillstyling.pro index 0002aad523..4ff8775877 100644 --- a/examples/simpletest_advancedlineandfillstyling/jkqtplotter_simpletest_advancedlineandfillstyling.pro +++ b/examples/simpletest_advancedlineandfillstyling/jkqtplotter_simpletest_advancedlineandfillstyling.pro @@ -29,6 +29,8 @@ win32-msvc* { # To fix error: C2338: va_start argument must not # have reference type and must not be parenthesized DEFINES += _CRT_NO_VA_START_VALIDATION + # fix errors with min()/max() macros from windows + DEFINES += NOMINMAX } diff --git a/examples/simpletest_datastore/jkqtplotter_simpletest_datastore.pro b/examples/simpletest_datastore/jkqtplotter_simpletest_datastore.pro index 4e7258517e..4a70d92f72 100644 --- a/examples/simpletest_datastore/jkqtplotter_simpletest_datastore.pro +++ b/examples/simpletest_datastore/jkqtplotter_simpletest_datastore.pro @@ -20,6 +20,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_datastore_statistics/README.md b/examples/simpletest_datastore_statistics/README.md index 7f844e0b9b..4c13755a2c 100644 --- a/examples/simpletest_datastore_statistics/README.md +++ b/examples/simpletest_datastore_statistics/README.md @@ -7,7 +7,7 @@ This tutorial project (see `./examples/simpletest_datastore_statistics/`) explai The source code of the main application can be found in [`jkqtplotter_simpletest_datastore_statistics.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp). This tutorial cites only parts of this code to demonstrate different ways of working with data for the graphs. -## Generating different sets of random numbers +# Generating different sets of random numbers The code segments below will fill four instances of JKQTPlotter with different statistical plots. All these plots are based on three sets of random numbers generated as shown here: ```.cpp @@ -34,7 +34,7 @@ The column `randomdatacol1` will contain 150 random numbers. Each one is drawn e The three columns are generated empyt by calling `JKQTPDatastore::addColumn()` with only a name. Then the actual values are added by calling `JKQTPDatastore::appendToColumn()`. -## Basic Statistics +# Basic Statistics The three sets of random numbers from above can be visualized e.g. by a `JKQTPPeakStreamGraph` graph with code as follows: ```.cpp @@ -82,9 +82,9 @@ Of course, several other functions exist that calculate basic statistics from a All these 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"). -## Boxplots +# Boxplots -### Standard Boxplots +## Standard Boxplots As mentioned above and shown in several other examples, JKQTPlotter supports [Boxplots](https://en.wikipedia.org/wiki/Box_plot) with the classes `JKQTPBoxplotHorizontalElement`, `JKQTPBoxplotVerticalElement`, as well as `JKQTPBoxplotHorizontal` and `JKQTPBoxplotVertical`. You can then use the 5-Number Summray functions from the statistics library to calculate the data for such a boxplot (e.g. `jkqtpstat5NumberStatistics()`) and set it up by hand. Code would look roughly like this: ```.cpp @@ -118,7 +118,7 @@ Here `-0.25`indicates the location (on the y-axis) of the boxplot. and the plot ![jkqtplotter_simpletest_datastore_statistics_boxplots_simple](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_datastore_statistics_boxplots_simple.png) -### Boxplots with Outliers +## Boxplots with Outliers Usually the boxplot draws its whiskers at the minimum and maximum value of the dataset. But if your data contains a lot of outliers, it may make sense to draw them e.g. at the 3% and 97% quantiles and the draw the outliers as additional data points. This can also be done with `jkqtpstat5NumberStatistics()`, as you can specify the minimum and maximum quantile (default is 0 and 1, i.e. the true minimum and maximum) and the resulting object contains a vector with the outlier values. Then you could add them to the JKQTPDatastore and add a scatter plot that displays them. Also this task is sped up by an "adaptor". Simply call @@ -136,7 +136,7 @@ As you can see this restuns the `JKQTPBoxplotHorizontalElement` and in addition -## Histograms +# Histograms Calculating 1D-Histograms is supported by several functions from the statistics library, e.g. `jkqtpstatHistogram1DAutoranged()`. You can use the result to fill new columns in a `JKQTPDatastore`, which can then be used to draw the histogram (here wit 15 bins, spanning the full data range): @@ -163,7 +163,7 @@ The resulting plot looks like this (the distributions used to generate the rando -## Kernel Density Estimates (KDE) +# Kernel Density Estimates (KDE) Especially when only few samples from a distribution are available, histograms are not good at representing the underlying data distribution. In such cases, [Kernel Density Estimates (KDE)](https://en.wikipedia.org/wiki/Kernel_density_estimation) can help, which are basically a smoothed variant of a histogram. The statistics library supports calculating them via e.g. `jkqtpstatKDE1D()`: @@ -210,7 +210,7 @@ Plots that result from such calls look like this: ![jkqtplotter_simpletest_datastore_statistics_kde](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_datastore_statistics_kde.png) -## Cummulative Histograms and KDEs +# Cummulative Histograms and KDEs Both histograms and KDEs support a parameter `bool cummulative`, which allows to accumulate the data after calculation and drawing cummulative histograms/KDEs: @@ -226,7 +226,7 @@ Both histograms and KDEs support a parameter `bool cummulative`, which allows to -## Screenshot of the full Program +# Screenshot of the full Program The output of the full test program [`jkqtplotter_simpletest_datastore_statistics.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp) looks like this: diff --git a/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp b/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp index ce3fcfc6d2..6da5377038 100644 --- a/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp +++ b/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.cpp @@ -1,7 +1,7 @@ /** \example jkqtplotter_simpletest_datastore_statistics.cpp * Explains how to use the internal statistics library (see \ref jkqtptools_statistics ) together with JKQTPDatastore to generate advanced plots for 1-dimensional data. * - * \ref JKQTPlottersimpletest_datastore_statistics + * \ref JKQTPlotterBasicJKQTPDatastoreStatistics */ #include diff --git a/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.pro b/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.pro index aeae323cfd..5b7780aae1 100644 --- a/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.pro +++ b/examples/simpletest_datastore_statistics/jkqtplotter_simpletest_datastore_statistics.pro @@ -20,6 +20,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.pro b/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.pro index 8c8e0257d5..dd6e3c20ae 100644 --- a/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.pro +++ b/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro b/examples/simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro index 4ccaa54d22..d2018ee28f 100644 --- a/examples/simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro +++ b/examples/simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro @@ -31,6 +31,8 @@ message("LIBS = $$LIBS") # To fix error: C2338: va_start argument must not # have reference type and must not be parenthesized DEFINES += _CRT_NO_VA_START_VALIDATION + # fix errors with min()/max() macros from windows + DEFINES += NOMINMAX } diff --git a/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.pro b/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.pro index 16f47c9e15..0d034e8feb 100644 --- a/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.pro +++ b/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.pro b/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.pro index 5374e45c8b..05da67fb2b 100644 --- a/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.pro +++ b/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.pro b/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.pro index 86eda59861..0bbb0e4077 100644 --- a/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.pro +++ b/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro b/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro index 1c9fbb9d85..1b4e6ad0d9 100644 --- a/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro +++ b/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro @@ -23,6 +23,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_parsedfunctionplot/README.md b/examples/simpletest_parsedfunctionplot/README.md index a60f5f8d84..b83770de9b 100644 --- a/examples/simpletest_parsedfunctionplot/README.md +++ b/examples/simpletest_parsedfunctionplot/README.md @@ -1,5 +1,7 @@ # Example (JKQTPlotter): Plotting Parsed Mathematical Functions as Line Graphs {#JKQTPlotterParsedFunctionPlot} -## Plot Function f(x) + +# Plot Function f(x) + This project (see `./examples/simpletest_parsedfunctionplot/`) demonstrates how to plot mathematical functions as line graphs. The functions are defined as strings that will be evaluated with the equation parser, integrated into JKQTPlotter. Note: See the example [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) if you don't want to draw parsed functions, but want to provide a C function, or C++ functor! @@ -44,7 +46,8 @@ This code snippet results in a plot like this: ![jkqtplotter_simpletest_parsedfunctionplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot.png) -## Plotting with parameters +# Plotting with parameters + As shown in [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot) you can also use externally set parameters in a plot function. These parameters can be double numbers and may be set with either as an internal parameter vector, or may be read from a parameter column (as shown in the [linked example](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_functionplot)). These parameters are available as variables `p1`, `p2`, ... in the function string. Here is a small example: ```.cpp @@ -54,13 +57,15 @@ As shown in [Plotting Mathematical Functions as Line Graphs](https://github.com/ parsedFunc->setTitle("user function"); ``` -## Plot Function f(y) +# Plot Function f(y) + If you use the graph class `JKQTPYParsedFunctionLineGraph` instead of `JKQTPXParsedFunctionLineGraph`, you can plot functions `x=f(y)` (instead of `y=f(x)`). The function from the example above will then ahve to be changed to `sin(y*8)*exp(-y/4)` and the result will look like this: ![jkqtplotter_simpletest_parsedfunctionplot_fy](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_fy.png) -## Properties of the Adaptive Plotting Algorithm +# Properties of the Adaptive Plotting Algorithm + The adaptive capabilities of the rendering algorithm can be seen, when plotting e.g. `2/x`, which is drawn smoothely, even around the undefined value at `x=0`: ![jkqtplotter_simpletest_parsedfunctionplot_2overx.png](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_2overx.png) diff --git a/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.pro b/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.pro index 582fd60e7b..ffd69eec5e 100644 --- a/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.pro +++ b/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_speed/jkqtplotter_simpletest_speed.pro b/examples/simpletest_speed/jkqtplotter_simpletest_speed.pro index ed1199b86e..086aa241d5 100644 --- a/examples/simpletest_speed/jkqtplotter_simpletest_speed.pro +++ b/examples/simpletest_speed/jkqtplotter_simpletest_speed.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro b/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro index 31fb4cf3d7..b2aa21bcb6 100644 --- a/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro +++ b/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro b/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro index 54fb217c21..189d87db3d 100644 --- a/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro +++ b/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro @@ -21,6 +21,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/simpletest_ui/README.md b/examples/simpletest_ui/README.md index acaba5a4ec..d6dc60e202 100644 --- a/examples/simpletest_ui/README.md +++ b/examples/simpletest_ui/README.md @@ -1,7 +1,7 @@ # Tutorial (JKQTPlotter): Using a JKQTPlotter inside a Qt User Interface Designer (UI) File {#JKQTPlotterQtCreator} This project (see `./examples/simpletest_ui/`) demonstrates how to create add a `JKQTPlotter` inside the Qt Form Editor (e.g. called from of Qt Creator) into a widget. -## Instructions on how to use JKQTPlotter in the Qt Form Designer +# Instructions on how to use JKQTPlotter in the Qt Form Designer For this to work you have to follow the steps shown below: @@ -16,7 +16,7 @@ For this to work you have to follow the steps shown below: -## QMake-Project of this example +# QMake-Project of this example The QMake project for such a project looks like this (see [`jkqtplotter_simpletest_ui.pro`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_ui/jkqtplotter_simpletest_ui.pro): ```.qmake @@ -47,6 +47,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX @@ -73,7 +74,7 @@ int main(int argc, char* argv[]) } ``` -## Form Class `FormWithJKQTPlotter` +# Form Class `FormWithJKQTPlotter` The Form was designed in the Qt Form Designer within Qt Creator, using the method described above (see `formwithjkqtplotter.ui`): diff --git a/examples/simpletest_ui/jkqtplotter_simpletest_ui.pro b/examples/simpletest_ui/jkqtplotter_simpletest_ui.pro index 24d6850b09..7e51875d04 100644 --- a/examples/simpletest_ui/jkqtplotter_simpletest_ui.pro +++ b/examples/simpletest_ui/jkqtplotter_simpletest_ui.pro @@ -25,6 +25,7 @@ CONFIG (debug, debug|release) { message("LIBS = $$LIBS") win32-msvc*: DEFINES += _USE_MATH_DEFINES +win32-msvc*: DEFINES += NOMINMAX diff --git a/examples/test_multiplot/test_multiplot.pro b/examples/test_multiplot/test_multiplot.pro index 593145756e..a43634eaef 100644 --- a/examples/test_multiplot/test_multiplot.pro +++ b/examples/test_multiplot/test_multiplot.pro @@ -29,6 +29,8 @@ win32-msvc* { # To fix error: C2338: va_start argument must not # have reference type and must not be parenthesized DEFINES += _CRT_NO_VA_START_VALIDATION + # fix errors with min()/max() macros from windows + DEFINES += NOMINMAX } diff --git a/examples/test_styling/README.md b/examples/test_styling/README.md index dbd8e8dd50..18129e04fb 100644 --- a/examples/test_styling/README.md +++ b/examples/test_styling/README.md @@ -2,7 +2,8 @@ [TOC] -## Basic Description +# Basic Description + This project (see `./examples/test_styling/`) demonstrates different types of user-interactions in JKQTPlotter. It contains a simple plot with two graphs and provides several widgets that allow to modify the plot styling by editing an INI file: @@ -10,9 +11,10 @@ It contains a simple plot with two graphs and provides several widgets that allo ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styling.png) -## Altering the Default Style +# Altering the Default Style + +## Global/System-wide Settings -### Global/System-wide Settings The `main()`-function can be found in [`test_styling_main.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling/test_styling_main.cpp). Here the Qt application is initialized in the usual way and the main window `win` is created and shown. After instanciating the `QApplication`, but befor instanciating the window (and thus the JKQTPlotter), you can already alter the system-wide default styling. It is accessible via the function `JKQTPGetSystemDefaultStyle()`, which returns a reference to the central style object of type `JKQTPlotterStyle`. In the example below, the color of the user-actions (e.g. of the zooming rectangle, that can be drawn with the mouse) is set to red: ```.cpp @@ -41,7 +43,7 @@ You can also store these settings in an INI-file (or any file supported by [`QSe JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings); ``` -### Apply a new Style to an Existing JKQTPlotter +## Apply a new Style to an Existing JKQTPlotter The major part of the source code of the main application can be found in [`test_styling.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling/test_styling.cpp). It opens a window with a plotter, that contains a set of test graphs to demonstrate the styling. The following function is connected to the "Update Graph"-button and applys the style defined by the INI in the plainTextEdit to the plotter: ```.cpp @@ -71,7 +73,7 @@ The major part of the source code of the main application can be found in [`tes ``` -## Some Example Styles +# Some Example Styles The following gallery shows a set of example styles: diff --git a/examples/test_styling/test_styling.pro b/examples/test_styling/test_styling.pro index 3fa63c823c..0c2bf0ca5d 100644 --- a/examples/test_styling/test_styling.pro +++ b/examples/test_styling/test_styling.pro @@ -39,6 +39,8 @@ win32-msvc* { # To fix error: C2338: va_start argument must not # have reference type and must not be parenthesized DEFINES += _CRT_NO_VA_START_VALIDATION + # fix errors with min()/max() macros from windows + DEFINES += NOMINMAX } diff --git a/examples/test_user_interaction/test_user_interaction.pro b/examples/test_user_interaction/test_user_interaction.pro index 9eec061c96..36ea38ae6b 100644 --- a/examples/test_user_interaction/test_user_interaction.pro +++ b/examples/test_user_interaction/test_user_interaction.pro @@ -32,6 +32,8 @@ win32-msvc* { # To fix error: C2338: va_start argument must not # have reference type and must not be parenthesized DEFINES += _CRT_NO_VA_START_VALIDATION + # fix errors with min()/max() macros from windows + DEFINES += NOMINMAX } diff --git a/lib/jkqtcommon/jkqtpmathparser.cpp b/lib/jkqtcommon/jkqtpmathparser.cpp index e532a1ca23..75faf90875 100644 --- a/lib/jkqtcommon/jkqtpmathparser.cpp +++ b/lib/jkqtcommon/jkqtpmathparser.cpp @@ -23,6 +23,7 @@ #include "jkqtcommon/jkqtpmathparser.h" // class's header file #include #include +#include #include "jkqtcommon/jkqtpstringtools.h" /* This just distinguishes between the different path formats on Windows and Unix: diff --git a/lib/jkqtcommon/jkqtpmathtools.h b/lib/jkqtcommon/jkqtpmathtools.h index a2eb4691a4..ebea7f8ebf 100644 --- a/lib/jkqtcommon/jkqtpmathtools.h +++ b/lib/jkqtcommon/jkqtpmathtools.h @@ -23,6 +23,7 @@ #define jkqtpmathtools_H_INCLUDED #include "jkqtcommon/jkqtp_imexport.h" #include +#include #include #include #include diff --git a/lib/jkqtcommon/jkqtpstatisticstools.h b/lib/jkqtcommon/jkqtpstatisticstools.h index 0be24ea86e..67f4536cde 100644 --- a/lib/jkqtcommon/jkqtpstatisticstools.h +++ b/lib/jkqtcommon/jkqtpstatisticstools.h @@ -718,7 +718,7 @@ inline double jkqtpstatMoment(InputIt first, InputIt last, int order, size_t* No -/*! \briefcalculate empirical (Pearson's) correlation coefficient between two given data ranges \a first1 ... \a last1 and \a first2 ... \a last2 +/*! \brief calculate empirical (Pearson's) correlation coefficient between two given data ranges \a first1 ... \a last1 and \a first2 ... \a last2 \ingroup jkqtptools_math_statistics_basic \tparam InputIt1 standard iterator type of \a first1 and \a last1. @@ -839,7 +839,7 @@ inline double jkqtpstatMedianOfSortedVector(const TVector& data, size_t* Noutput Entries in the range that are invalid double (using JKQTPIsOKFloat() ) are ignored when calculating. - \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics + \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics */ template inline void jkqtpstat5NumberStatisticsOfSortedVector(const TVector& data, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double* quantile1=nullptr, double quantile1Spec=0.25, double* quantile2=nullptr, double quantile2Spec=0.75, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) { @@ -902,7 +902,7 @@ inline void jkqtpstat5NumberStatisticsOfSortedVector(const TVector& data, double Entries in the range that are invalid double (using JKQTPIsOKFloat() ) are ignored when calculating. - \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics + \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics */ template inline void jkqtpstat5NumberStatisticsAndOutliersOfSortedVector(const TVector& data, OutputIt outliersout, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double* quantile1=nullptr, double quantile1Spec=0.25, double* quantile2=nullptr, double quantile2Spec=0.75, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) { @@ -971,7 +971,7 @@ inline void jkqtpstat5NumberStatisticsAndOutliersOfSortedVector(const TVector& d Entries in the range that are invalid double (using JKQTPIsOKFloat() ) are ignored when calculating. - \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics + \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics */ template inline void jkqtpstat5NumberStatistics(InputIt first, InputIt last, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double quantile1Spec=0.25, double* quantile1=nullptr, double quantile2Spec=0.75, double* quantile2=nullptr, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) { @@ -1008,7 +1008,7 @@ inline void jkqtpstat5NumberStatistics(InputIt first, InputIt last, double* mini Entries in the range that are invalid double (using JKQTPIsOKFloat() ) are ignored when calculating. - \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics + \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics */ template inline void jkqtpstat5NumberStatisticsAndOutliers(InputIt first, InputIt last, OutputIt outliersout, double* minimum=nullptr, double minimumQuantile=0, double* median=nullptr, double* maximum=nullptr, double maximumQuantile=1, double* quantile1=nullptr, double quantile1Spec=0.25, double* quantile2=nullptr, double quantile2Spec=0.75, double* IQR=nullptr, double* IQRSignificance=nullptr, size_t* Noutput=nullptr) { @@ -1071,7 +1071,7 @@ struct JKQTPStat5NumberStatistics { Entries in the range that are invalid double (using JKQTPIsOKFloat() ) are ignored when calculating. - \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlottersimpletest_datastore_statistics + \see https://en.wikipedia.org/wiki/Five-number_summary, jkqtpstatAddVBoxplotAndOutliers, jkqtpstatAddHBoxplotAndOutliers, jkqtpstatAddVBoxplot, jkqtpstatAddHBoxplot, \ref JKQTPlotterBasicJKQTPDatastoreStatistics */ template inline JKQTPStat5NumberStatistics jkqtpstat5NumberStatistics(InputIt first, InputIt last, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0, double maximumQuantile=1.0) { @@ -1425,6 +1425,379 @@ inline void jkqtpstatHistogram1D(InputIt first, InputIt last, BinsInputIt binsFi + + + + + + + +/*! \brief a 1D Gaussian kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t):=\frac{1}{\sqrt{2\pi}}\exp \left(-\frac{1}{2}t^2\right) \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DGaussian(double t); +/*! \brief a 1D Cauchy kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t):=\frac{1}{\pi(1+t^2)} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DCauchy(double t); + +/*! \brief a 1D Picard kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t):=\frac{1}{2}\exp(-|t|) \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DPicard(double t); +/*! \brief a 1D Epanechnikov kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}\frac{3}{4} ( 1- t^2 ), & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DEpanechnikov(double t); +/*! \brief a 1D uniform kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}1, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DUniform(double t); +/*! \brief a 1D Epanechnikov kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}1-|t|, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DTriangle(double t); + +/*! \brief a 1D quartic kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}\frac{15}{16}(1-t^2)^2, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DQuartic(double t); +/*! \brief a 1D triweight kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}\frac{35}{32}(1-t^2)^3, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DTriweight(double t); + +/*! \brief a 1D tricube kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}\frac{70}{81}(1-|t|^3)^3, & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DTricube(double t); +/*! \brief a 1D cosine kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_1dkde + + \f[ k(t) :=\begin{cases}\frac{\pi}{4}\cos\left(\frac{\pi}{2}t\right), & \text{if }t\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel1DCosine(double t); + + + + + + + + + + + + + +/*! \brief a 1D Gaussian kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_2dkde + + \f[ k(t_x, t_y):=\frac{1}{2\pi}\exp \left(-\frac{t_x^2+t_y^2}{2}\right) \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel2DGaussian(double tx, double ty); + +/*! \brief a 1D Gaussian kernel function, e.g. for Kernel Density Estimation + \ingroup jkqtptools_math_statistics_2dkde + + \f[ k(t_x, t_y):=\begin{cases}\frac{1}{4}, & \text{if }t_x,t_y\in [-1;1]\\0, & \text{else}\end{cases} \f] +*/ +JKQTP_LIB_EXPORT double jkqtpstatKernel2DUniform(double tx, double ty); + + + + + + + + + + + + + + + + + + + +/*! \brief estimates a bandwidth for a Kernel Density Estimator (KDE) of the given data \a first ... \a last + \ingroup jkqtptools_math_statistics_1dkde + + evaluates \f[ h = \left(\frac{4\hat{\sigma}^5}{3n}\right)^{\frac{1}{5}} \approx 1.06 \hat{\sigma} n^{-1/5} \f] + + \tparam InputIt standard iterator type of \a first and \a last. + \param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$ + \param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$ + \return the estimated bandwidth + +*/ +template +inline double jkqtpstatEstimateKDEBandwidth(InputIt first, InputIt last) { + size_t N=0; + const double sigma=jkqtpstatStdDev(first, last, nullptr, &N); + return 1.06*sigma/pow(static_cast(N), 1.0/5.0); +} + + + + +/*! \brief evaluates the Kernel Density Estimator (KDE) at a given position + \ingroup jkqtptools_math_statistics_1dkde + + evaluates \f[ \tilde{f}(t):=\frac{1}{N\cdot\text{bandwidth}}\cdot\sum\limits_{i=0}^{N-1}K\left(\frac{t-x_i}{\text{bandwidth}}\right) \f] + + \tparam InputIt standard iterator type of \a first and \a last. + \param t where to evaluate the kernel sum + \param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$ + \param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$ + \param kernel the kernel function to use (e.g. jkqtpstatKernel1DGaussian() ) + \param bandwidth bandwidth used for the KDE + +*/ +template +inline double jkqtpstatEvaluateKernelSum(double t, InputIt first, InputIt last, const std::function& kernel, double bandwidth) { + double res=0; + size_t cnt=0; + for (auto it=first; it!=last; ++it) { + const double v=jkqtp_todouble(*it); + if (JKQTPIsOKFloat(v)) { + const double vx=(t-v)/bandwidth; + res+=kernel(vx); + cnt++; + } + } + return res/static_cast(cnt)/bandwidth; +} + + + + +/*! \brief calculate an autoranged 1-dimensional Kernel Density Estimation (KDE) from the given data range \a first ... \a last, bins defined by their number + \ingroup jkqtptools_math_statistics_1dkde + + \tparam InputIt standard iterator type of \a first and \a last. + \tparam OutputIt standard output iterator type used for the outliers output \a KDEXOut and \a KDEYOut, use e.g. std::back_inserter + \param first iterator pointing to the first item in the dataset to use \f$ X_1 \f$ + \param last iterator pointing behind the last item in the dataset to use \f$ X_N \f$ + \param kernel the kernel function to use (e.g. jkqtpstatKernel1DGaussian() ) + \param bandwidth bandwidth used for the KDE + \param[out] KDEXOut output iterator that receives x-positions of the KDE bins. Location of this value inside the bin range is defined by \a binXMode + \param[out] KDEYOut output iterator that receives counts/frequencies of the KDE bins + \param Nout number datapoints in the output KDE + \param cummulative if \c true, a cummulative KDE is calculated + + This function performs Kernel Density Estimation for a given data array. + Then the resulting density is evaluated on a regular grid spanning [min(X)...max(X)] with bins datapoints in between. + + \warning this functions is getting very slow for large dataset, as for each point in the resulting histogram N kernel functions have to be evaluated. + + \see en.wikipedia.org/wiki/Kernel_density_estimation, \ref JKQTPlotterBasicJKQTPDatastoreStatistics +*/ +template +inline void jkqtpstatKDE1DAutoranged(InputIt first, InputIt last, OutputIt KDEXOut, OutputIt KDEYOut, int Nout=100, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) { + double minV=0, maxV=0; + size_t N=0; + jkqtpstatMinMax(first, last, minV, maxV, nullptr, nullptr, &N); + + std::vector histX; + std::vector histY; + + const double range=maxV-minV; + const double binw=range/static_cast(Nout); + + // calculate the KDE + for (int i=0; i(i)*binw+binw/2.0; + histX.push_back(x); + histY.push_back(jkqtpstatEvaluateKernelSum(x, first, last, kernel, bandwidth)); + } + + + // output the KDE + double h=0; + for (size_t i=0; iKernel Density Estimation for a given data array. + Then the resulting density is evaluated on a regular grid spanning [min(X)...max(X)] with bins datapoints in between. + + \warning this functions is getting very slow for large dataset, as for each point in the resulting histogram N kernel functions have to be evaluated. + + \see en.wikipedia.org/wiki/Kernel_density_estimation, \ref JKQTPlotterBasicJKQTPDatastoreStatistics +*/ +template +inline void jkqtpstatKDE1DAutoranged(InputIt first, InputIt last, OutputIt KDEXOut, OutputIt KDEYOut, double binWidth, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) { + double minV=0, maxV=0; + size_t N=0; + jkqtpstatMinMax(first, last, minV, maxV, nullptr, nullptr, &N); + + std::vector histX; + std::vector histY; + + const double range=maxV-minV; + const double binw=binWidth; + const int Nout=static_cast(ceil(range/binWidth)); + + // calculate the KDE + for (int i=0; i(i)*binw+binw/2.0); + histY.push_back(jkqtpstatEvaluateKernelSum(*(histX.end()), first, last, kernel, bandwidth)); + } + + + // output the KDE + + double h=0; + for (size_t i=0; i +inline void jkqtpstatKDE1D(InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, OutputIt KDEXOut, OutputIt KDEYOut, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) { + double minV=0, maxV=0; + size_t N=0; + jkqtpstatMinMax(first, last, minV, maxV, nullptr, nullptr, &N); + + std::vector histX; + std::vector histY; + + + // initialize the KDE + for (auto it=binsFirst; it!=binsLast; ++it) { + histX.push_back(jkqtp_todouble(*it)); + } + std::sort(histX.begin(), histX.end()); + + // calculate the KDE + for (auto it=histX.begin(); it!=histX.end(); ++it) { + histY.push_back(jkqtpstatEvaluateKernelSum(*it, first, last, kernel, bandwidth)); + } + + + // output the KDE + double h=0; + for (size_t i=0; i +inline void jkqtpstatKDE1D(InputIt first, InputIt last, double binXLeft, double binXDelta, double binXRight, OutputIt KDEXOut, OutputIt KDEYOut, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false) { + double minV=0, maxV=0; + size_t N=0; + jkqtpstatMinMax(first, last, minV, maxV, nullptr, nullptr, &N); + + std::vector histX; + std::vector histY; + + + // calculate the KDE + for (double x=binXLeft; x<=binXRight; x+=binXDelta) { + histX.push_back(x); + histY.push_back(jkqtpstatEvaluateKernelSum(x, first, last, kernel, bandwidth)); + } + + + // output the KDE + double h=0; + for (size_t i=0; i #include +#include #include /************************************************************************************************************************** @@ -395,8 +396,9 @@ JKQTPColumnConstIterator JKQTPDatastore::end(size_t i) const //////////////////////////////////////////////////////////////////////////////////////////////// JKQTPColumnBackInserter JKQTPDatastore::backInserter(int i) { - auto it=columns.find(i); - if (i<0 || it==columns.end()) return JKQTPColumnBackInserter(this, std::numeric_limits::max()); + if (i<0) return JKQTPColumnBackInserter(this, std::numeric_limits::max()); + auto it=columns.find(static_cast(i)); + if (it==columns.end()) return JKQTPColumnBackInserter(this, std::numeric_limits::max()); else return JKQTPColumnBackInserter(this, static_cast(i)); } diff --git a/lib/jkqtplotter/jkqtpdatastorage.h b/lib/jkqtplotter/jkqtpdatastorage.h index 6baabe08ae..16426d4260 100644 --- a/lib/jkqtplotter/jkqtpdatastorage.h +++ b/lib/jkqtplotter/jkqtpdatastorage.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -85,163 +84,163 @@ enum class JKQTPDatastoreItemFormat { MatrixRow, /*!< \brief a 1D C-array of doubles that represents a number of rows (C standard representation of matrices). The data is stored row after row (=row-major).*/ }; -/*! \brief This class manages data columns (with entries of type \c double ), used by JKQTPlotter/JKQTBasePlotter to represent data for plots - \ingroup jkqtpdatastorage - - \see \ref JKQTPlotterBasicJKQTPDatastore for a detailed description of how to use this class for data management! - - - \section jkqtpdatastore_column_management Column Management - - \subsection jkqtpdatastore_column_management_generation Column Generation/Deletion - - A JKQTPDatastore manages a set of data columns. Each column is a continuous vector of numbers. Optionally it can be interpreted - as a 2D image. In the latter case, the data is assumed to be ordered in row-major ordering (i.e. row for row). - - You can generate new columns e.g. by: - - addColumn() which either generates internally managed (and extensible) columns, or accepts a simple \c double* pointer - to external. In the latter case owner-ship may be transferred to the datastore, but can also retain externally. - - addImageColumn() adds a column that should be interpreted as an image with given width and height (i.e. a row-major - matrix with \c width columns and \c height rows. - - copyColumn() duplicates an existing column - - addCopiedColumn() copies an external dataset into the datastore. e.g. with code like: - \code - QVector X, Y; - const int Ndata=100; - for (int i=0; isetXColumn(datastore->addCopiedColumn(X, "x")); - linegraph->setYColumn(datastore->addCopiedColumn(Y, "y")); - \endcode - - addLinearColumn() adds a column with linearly increasing numbers (in a given range) - - addLogColumn() and addDecadeLogColumn() add columns with logarithmically spaced values - - addLinearGridColumns() adds two columns which represent x- and y- coordinates of points - on a rectangular grid (useful for calculating image data) - - addCalculatedColumn() calculates a column, based on row numbers and a C++ functor - - addColumnCalculatedFromColumn() calculates a column, based on another column data - - addCopiedMap() copies data from a std::map/QMap into two columns - - ... several more functions for specific cases exist. - - Also note that there are even library extensions that allow to import data directly from OpenCV matrices: JKQTPCopyCvMatToColumn() - . - - Of course columns can also be deleted by calling: - - deleteColumn() - - deleteAllColumns() - - deleteAllPrefixedColumns() - - clear() - . - - \subsection jkqtpdatastore_column_management_props Column Properties - - The properties of columns may be accessed using: - - getRows() returns the number of rows in a specific column - - getColumnPointer() returns a pointer to the data in the column - - getColumnChecksum() calculated a checksum over the data in the column - - getColumnNames() / getColumnName() - . - - \subsection jkqtpdatastore_column_management_modify Modify Column Contents - - You can modify all data in a column by functions like: - - setAll() - - scaleColumnValues() - . - - Also you can access a single entry from a column, using: - - set() / get() set/read a column entry - - inc() / dec() increment/decrement a column entry - - appendToColumn() (adds a single row/new value to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!) - - appendFromContainerToColumn() (adds several rows from a container to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!) - . - - \subsection jkqtpdatastore_column_management_iterators Iterator Interface - - In addition to teh fucntions above, JKQTPDatastore also provides C++-style iteratos to read the data from a column: - - begin() - - end() - . - - ... and also a \c std::back_inserter -style interface to append data to columns: - - backInserter() - . - - These allow to use the C++ standard algorithms to work with columns and also enabled the - library \ref jkqtptools_math_statistics in this software package. You can use the functions - above e.g. for code like: - - \code - auto inserter it=datastore->backInserter(datastore->addColumn("new column")); - for (auto it=datastore->begin(col1); it!=datastore->begin(col1) ++it) { - *++inserter=sqrt(*it); - } - \endcode - - or simply - - \code - // mean of a column in a JKQTPDatastore: - double mean=jkqtpstatAverage(datastore1->begin(col1), datastore1->end(col1)); - \endcode - - Also there are functions to add data from iterator-defined ranges, e.g.: - - addCopiedColumn() - - addCopiedMap() - - appendToColumn() - . - - - \subsection jkqtpdatastore_column_management_images Image Column - - JKQTPDatastore stores the width and height of the represented image as metadata with any image column. - This metadata is used to provide convenience access to the image pixels with: - - setPixel() - - getPixel() - . - - The image width/height are read using: - - getColumnImageWidth() - - getColumnImageHeight() - . - - This allows to write code like: - \code - for (int iy=0; iy<10; iy++) { - for (int ix=0; ix<10; ix++) { - datastore->setPixel(imgColumn, ix, iy, sin(ix*iy/30.0)); - } - } - \endcode - - \section jkqtpdatastore_dataio Data Output - - JKQTPDatastore provides several functions that allow to store its contents into files: - - saveCSV - - saveSYLK() - - saveMatlab() - - saveDIF() - . - - ... and function to read data into different data structures: - - getData() - . - - - - - \section jkqtpdatastore_internals Internal Working - - This class manages a list if JKQTPDatastoreItem onjects that may each contain a chunk of memory, containig - one or more columns of data. Each item can be accessed with get() by a specific ID which is returned by add(). - JKQTPColumn. You may only clear all chunks of memory/items. If you no longer need some of the data, but still want - to access the rest you will simply have to destroy all JKQTPColumn that point to the item with their - JKQTPColumns:datastoreItem property. - - \verbatim +/** \brief This class manages data columns (with entries of type \c double ), used by JKQTPlotter/JKQTBasePlotter to represent data for plots + * \ingroup jkqtpdatastorage + * + * \see \ref JKQTPlotterBasicJKQTPDatastore for a detailed description of how to use this class for data management! + * + * + * \section jkqtpdatastore_column_management Column Management + * + * \subsection jkqtpdatastore_column_management_generation Column Generation/Deletion + * + * A JKQTPDatastore manages a set of data columns. Each column is a continuous vector of numbers. Optionally it can be interpreted + * as a 2D image. In the latter case, the data is assumed to be ordered in row-major ordering (i.e. row for row). + * + * You can generate new columns e.g. by: + * - addColumn() which either generates internally managed (and extensible) columns, or accepts a simple \c double* pointer + * to external. In the latter case owner-ship may be transferred to the datastore, but can also retain externally. + * - addImageColumn() adds a column that should be interpreted as an image with given width and height (i.e. a row-major + * matrix with \c width columns and \c height rows. + * - copyColumn() duplicates an existing column + * - addCopiedColumn() copies an external dataset into the datastore. e.g. with code like: + * \code{.cpp} + * QVector X, Y; + * const int Ndata=100; + * for (int i=0; isetXColumn(datastore->addCopiedColumn(X, "x")); + * linegraph->setYColumn(datastore->addCopiedColumn(Y, "y")); + * \endcode + * - addLinearColumn() adds a column with linearly increasing numbers (in a given range) + * - addLogColumn() and addDecadeLogColumn() add columns with logarithmically spaced values + * - addLinearGridColumns() adds two columns which represent x- and y- coordinates of points + * on a rectangular grid (useful for calculating image data) + * - addCalculatedColumn() calculates a column, based on row numbers and a C++ functor + * - addColumnCalculatedFromColumn() calculates a column, based on another column data + * - addCopiedMap() copies data from a std::map/QMap into two columns + * - ... several more functions for specific cases exist. + * - Also note that there are even library extensions that allow to import data directly from OpenCV matrices: JKQTPCopyCvMatToColumn() + * . + * + * Of course columns can also be deleted by calling: + * - deleteColumn() + * - deleteAllColumns() + * - deleteAllPrefixedColumns() + * - clear() + * . + * + * \subsection jkqtpdatastore_column_management_props Column Properties + * + * The properties of columns may be accessed using: + * - getRows() returns the number of rows in a specific column + * - getColumnPointer() returns a pointer to the data in the column + * - getColumnChecksum() calculated a checksum over the data in the column + * - getColumnNames() / getColumnName() + * . + * + * \subsection jkqtpdatastore_column_management_modify Modify Column Contents + * + * You can modify all data in a column by functions like: + * - setAll() + * - scaleColumnValues() + * . + * + * Also you can access a single entry from a column, using: + * - set() / get() set/read a column entry + * - inc() / dec() increment/decrement a column entry + * - appendToColumn() (adds a single row/new value to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!) + * - appendFromContainerToColumn() (adds several rows from a container to a column, if the column was not internally managed before, it will be copied into a new internal memory segment by the first call to this function!) + * . + * + * \subsection jkqtpdatastore_column_management_iterators Iterator Interface + * + * In addition to teh fucntions above, JKQTPDatastore also provides C++-style iteratos to read the data from a column: + * - begin() + * - end() + * . + * + * ... and also a \c std::back_inserter -style interface to append data to columns: + * - backInserter() + * . + * + * These allow to use the C++ standard algorithms to work with columns and also enabled the + * library \ref jkqtptools_math_statistics in this software package. You can use the functions + * above e.g. for code like: + * + * \code{.cpp} + * auto inserter it=datastore->backInserter(datastore->addColumn("new column")); + * for (auto it=datastore->begin(col1); it!=datastore->begin(col1) ++it) { + * *++inserter=sqrt(*it); + * } + * \endcode + * + * or simply + * + * \code{.cpp} + * // mean of a column in a JKQTPDatastore: + * double mean=jkqtpstatAverage(datastore1->begin(col1), datastore1->end(col1)); + * \endcode + * + * Also there are functions to add data from iterator-defined ranges, e.g.: + * - addCopiedColumn() + * - addCopiedMap() + * - appendToColumn() + * . + * + * + * \subsection jkqtpdatastore_column_management_images Image Column + * + * JKQTPDatastore stores the width and height of the represented image as metadata with any image column. + * This metadata is used to provide convenience access to the image pixels with: + * - setPixel() + * - getPixel() + * . + * + * The image width/height are read using: + * - getColumnImageWidth() + * - getColumnImageHeight() + * . + * + * This allows to write code like: + * \code{.cpp} + * for (int iy=0; iy<10; iy++) { + * for (int ix=0; ix<10; ix++) { + * datastore->setPixel(imgColumn, ix, iy, sin(ix*iy/30.0)); + * } + * } + * \endcode + * + * \section jkqtpdatastore_dataio Data Output + * + * JKQTPDatastore provides several functions that allow to store its contents into files: + * - saveCSV + * - saveSYLK() + * - saveMatlab() + * - saveDIF() + * . + * + * ... and function to read data into different data structures: + * - getData() + * . + * + * + * + * + * \section jkqtpdatastore_internals Internal Working + * + * This class manages a list if JKQTPDatastoreItem onjects that may each contain a chunk of memory, containig + * one or more columns of data. Each item can be accessed with get() by a specific ID which is returned by add(). + * JKQTPColumn. You may only clear all chunks of memory/items. If you no longer need some of the data, but still want + * to access the rest you will simply have to destroy all JKQTPColumn that point to the item with their + * JKQTPColumns:datastoreItem property. + * + * \verbatim +- JKQTPDatastore ---------------------+ std::vector: | | +- JKQTPColumn ----------------+ @@ -269,11 +268,11 @@ enum class JKQTPDatastoreItemFormat { \endverbatim - - In addition the JKQTPDatastore manages a std::vector which may be used to access the data chunks in the logical - notion of data columns. This class provides a set of interface methods for this list: - - */ + * + * In addition the JKQTPDatastore manages a std::vector which may be used to access the data chunks in the logical + * notion of data columns. This class provides a set of interface methods for this list: + * + */ class JKQTP_LIB_EXPORT JKQTPDatastore{ private: /** \brief a std::vector that contains all items managed by this datastore */ diff --git a/lib/jkqtplotter/jkqtpgraphsstatisticsadaptors.h b/lib/jkqtplotter/jkqtpgraphsstatisticsadaptors.h index 60167eb4c3..ac248c400d 100644 --- a/lib/jkqtplotter/jkqtpgraphsstatisticsadaptors.h +++ b/lib/jkqtplotter/jkqtpgraphsstatisticsadaptors.h @@ -48,7 +48,7 @@ jkqtpstatAddHBoxplot(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), -0.3); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics() + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics() */ template inline JKQTPBoxplotHorizontalElement* jkqtpstatAddHBoxplot(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposY, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0, double maximumQuantile=1.0, JKQTPStat5NumberStatistics* statOutput=nullptr) { @@ -93,7 +93,7 @@ inline JKQTPBoxplotHorizontalElement* jkqtpstatAddHBoxplot(JKQTBasePlotter* plot jkqtpstatAddVBoxplot(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), -0.3); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics() + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics() */ template inline JKQTPBoxplotVerticalElement* jkqtpstatAddVBoxplot(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposX, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0, double maximumQuantile=1.0, JKQTPStat5NumberStatistics* statOutput=nullptr) { @@ -143,7 +143,7 @@ inline JKQTPBoxplotVerticalElement* jkqtpstatAddVBoxplot(JKQTBasePlotter* plotte 0.05, 0.95 // Quantiles for the boxplot box whiskers' ends \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics() + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics() */ template inline std::pair jkqtpstatAddHBoxplotAndOutliers(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposY, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0.03, double maximumQuantile=0.97, const QString& outliercolumnBaseName=QString("boxplot"), JKQTPStat5NumberStatistics* statOutput=nullptr) { @@ -202,7 +202,7 @@ inline std::pair 0.05, 0.95 // Quantiles for the boxplot box whiskers' ends \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstat5NumberStatistics() + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstat5NumberStatistics() */ template inline std::pair jkqtpstatAddVBoxplotAndOutliers(JKQTBasePlotter* plotter, InputIt first, InputIt last, double boxposX, double quantile1Spec=0.25, double quantile2Spec=0.75, double minimumQuantile=0.03, double maximumQuantile=0.97, const QString& outliercolumnBaseName=QString("boxplot"), JKQTPStat5NumberStatistics* statOutput=nullptr) { @@ -255,7 +255,7 @@ inline std::pair jk jkqtpstatAddHHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 11); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph */ template inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, int bins=11, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) { @@ -290,7 +290,7 @@ inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter jkqtpstatAddHHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 0.5); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarVerticalGraph */ template inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binWidth, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) { @@ -327,7 +327,7 @@ inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1DAutoranged(JKQTBasePlotter jkqtpstatAddHHistogram1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end()); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1D(), JKQTPBarVerticalGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1D(), JKQTPBarVerticalGraph */ template inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) { @@ -361,7 +361,7 @@ inline JKQTPBarVerticalGraph* jkqtpstatAddHHistogram1D(JKQTBasePlotter* plotter, jkqtpstatAddVHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 11); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph */ template inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, int bins=11, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) { @@ -396,7 +396,7 @@ inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlott jkqtpstatAddVHistogram1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 0.5); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1DAutoranged(), JKQTPBarHorizontalGraph */ template inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binWidth, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) { @@ -433,7 +433,7 @@ inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1DAutoranged(JKQTBasePlott jkqtpstatAddVHistogram1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end()); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatHistogram1D(), JKQTPBarHorizontalGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatHistogram1D(), JKQTPBarHorizontalGraph */ template inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, bool normalized=true, bool cummulative=false, const QString& histogramcolumnBaseName=QString("histogram")) { @@ -478,7 +478,7 @@ inline JKQTPBarHorizontalGraph* jkqtpstatAddVHistogram1D(JKQTBasePlotter* plotte jkqtpstatAddHKDE1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 200); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph */ template inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, int Nout=100, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) { @@ -516,7 +516,7 @@ inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter, jkqtpstatAddHKDE1DAutoranged(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), 0.01); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1DAutoranged(), JKQTPXYLineGraph */ template inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binWidth, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) { @@ -556,7 +556,7 @@ inline JKQTPXYLineGraph* jkqtpstatAddHKDE1DAutoranged(JKQTBasePlotter* plotter, jkqtpstatAddHKDE1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end()); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1D(), JKQTPXYLineGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1D(), JKQTPXYLineGraph */ template inline JKQTPXYLineGraph* jkqtpstatAddHKDE1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, BinsInputIt binsFirst, BinsInputIt binsLast, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) { @@ -595,7 +595,7 @@ inline JKQTPXYLineGraph* jkqtpstatAddHKDE1D(JKQTBasePlotter* plotter, InputIt fi jkqtpstatAddHKDE1D(plot1->getPlotter(), datastore1->begin(randomdatacol1), datastore1->end(randomdatacol1), bins.begin(), bins.end()); \endcode - \see \ref JKQTPlottersimpletest_datastore_statistics, jkqtpstatKDE1D(), JKQTPXYLineGraph + \see \ref JKQTPlotterBasicJKQTPDatastoreStatistics, jkqtpstatKDE1D(), JKQTPXYLineGraph */ template inline JKQTPXYLineGraph* jkqtpstatAddHKDE1D(JKQTBasePlotter* plotter, InputIt first, InputIt last, double binXLeft, double binXDelta, double binXRight, const std::function& kernel=std::function(&jkqtpstatKernel1DGaussian), double bandwidth=1.0, bool cummulative=false, const QString& KDEcolumnBaseName=QString("KDE")) {