diff --git a/JKQtPlotterBuildAllExamples.pro b/JKQtPlotterBuildAllExamples.pro
index a8c7ec1876..f4b14b9f97 100644
--- a/JKQtPlotterBuildAllExamples.pro
+++ b/JKQtPlotterBuildAllExamples.pro
@@ -51,6 +51,7 @@ addSimpleTest(speed)
addSimpleTest(rgbimageplot_qt)
addSimpleTest(impulsesplot)
addSimpleTest(paramscatterplot)
+addSimpleTest(paramscatterplot_image)
addSimpleTest(parametriccurve)
addSimpleTest(parsedfunctionplot)
addSimpleTest(functionplot)
diff --git a/README.md b/README.md
index 77b9f901a5..acef83d6c3 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_filledgraphs) | [Filled Curve Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_filledgraphs) | `JKQTPbarVerticalGraph`
setting/altering data in `JKQTPdatstore` directly
transparent plots
calculating histograms |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_impulsesplot) | [Impulse Plots](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_impulsesplot) | `JKQTPimpulsesVerticalGraph` and `JKQTPimpulsesHorizontalGraph`
C++-style QVector as plot data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot) | `JKQTPxyParametrizedScatterGraph`
C++-style QVector as plot data
modify scatter/points/line-graph properties by data |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_paramscatterplot_image) | `JKQTPxyParametrizedScatterGraph`
C++-style QVector as plot data
rectangular arrangement of scatters
generative computer graphics |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parametriccurve) | [Plotting Parametric Curves](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parametriccurve) | `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph`
C++-style QVector as plot data
parametric curve plotting |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_functionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_functionplot) | `JKQTPxFunctionLineGraph`
diretly plotting C/C++-functions |
[![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](https://github.com/jkriege2/JKQtPlotter/tree/master/test/simpletest_parsedfunctionplot) | `JKQTPxParsedFunctionLineGraph`
plotting functions with the internal math equation parser/evaluator |
diff --git a/lib/jkqtplotter/jkqtpgraphs.h b/lib/jkqtplotter/jkqtpgraphs.h
index fb0a8f3c57..dd7f6bc2ae 100644
--- a/lib/jkqtplotter/jkqtpgraphs.h
+++ b/lib/jkqtplotter/jkqtpgraphs.h
@@ -198,13 +198,13 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi
/** \brief this column contains the line width */
int linewidthColumn;
- /** \brief if the gridModeForSymbolSize mode is actiavted (false), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
+ /** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
bool gridModeForSymbolSize;
- /** \brief if the gridModeForSymbolSize mode is actiavted (false), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
+ /** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
double gridDeltaX;
- /** \brief if the gridModeForSymbolSize mode is actiavted (false), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
+ /** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
double gridDeltaY;
- /** \brief if the gridModeForSymbolSize mode is actiavted (false), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
+ /** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
double gridSymbolFractionSize;
/** \brief if this is true, the value in the colorColumn is converted to an integer, representing a color in ARGB format (as in QRgb) */
diff --git a/screenshots/jkqtplotter_simpletest_paramscatterplot_image.png b/screenshots/jkqtplotter_simpletest_paramscatterplot_image.png
new file mode 100644
index 0000000000..09537e4667
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_paramscatterplot_image.png differ
diff --git a/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette.png b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette.png
new file mode 100644
index 0000000000..0c944feee7
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette.png differ
diff --git a/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette_triangle.png b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette_triangle.png
new file mode 100644
index 0000000000..5c11f46b6c
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette_triangle.png differ
diff --git a/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png
new file mode 100644
index 0000000000..2539174763
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png differ
diff --git a/screenshots/jkqtplotter_simpletest_paramscatterplot_image_star.png b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_star.png
new file mode 100644
index 0000000000..47988348d2
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_star.png differ
diff --git a/screenshots/jkqtplotter_simpletest_paramscatterplot_image_varsymbol.png b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_varsymbol.png
new file mode 100644
index 0000000000..6cd6cfb021
Binary files /dev/null and b/screenshots/jkqtplotter_simpletest_paramscatterplot_image_varsymbol.png differ
diff --git a/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.cpt b/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.cpt
deleted file mode 100644
index 09eb5b49be..0000000000
Binary files a/screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.cpt and /dev/null differ
diff --git a/test/simpletest_paramscatterplot_image/README.md b/test/simpletest_paramscatterplot_image/README.md
new file mode 100644
index 0000000000..85cfc2575e
--- /dev/null
+++ b/test/simpletest_paramscatterplot_image/README.md
@@ -0,0 +1,99 @@
+[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
+
+# JKQtPlotter
+
+## Draw an Artistic Image with a Parametrized Scatter Graph
+This project (see `./test/simpletest_paramscatterplot_image/`) demonstrates the capabilities of `JKQTPxyParametrizedScatterGraph` to display parametrized scatters in a rectangular arrangement. See the test program in [`test/simpletest_paramscatterplot`](https://github.com/jkriege2/JKQtPlotter/blob/master/test/simpletest_paramscatterplot) for a basic example of the capabilities of `JKQTPxyParametrizedScatterGraph`.
+
+In this example, we load an image, convert it to greyscale and store it, together with x/y-coordinate-vectors in the datastore. Then a `JKQTPxyParametrizedScatterGraph` is used to draw the image as a pointilistic artwork, where each pixel is represented by a disk. The color of the disk is chosen from a color-palette, based on the grey-value. The size of each disk is chosen from the inverse grey value.
+
+First we prepare the data, as described above. The image is loaded and then converted to the required data vectors.
+```c++
+ // 2.1 load image
+ QImage image(":/example.bmp");
+ QVector imageVector, pointSizes;
+ QVector X,Y;
+
+ // 2.2 convert image to greyscale, stored in a vector in row-major order
+ double maxSymbolSize=30; // maximal diameter of symbols in pt
+ for (int y=0; y(255-qGray(image.pixel(x,y)))/255.0*maxSymbolSize);
+ // calculate X/Y-coordinates (y mirrored, so image is upright)
+ X.push_back(x);
+ Y.push_back(image.height()-1-y);
+ }
+ }
+
+ // 2.3 and copy it to the datastore
+ size_t columnX=ds->addCopiedColumn(X, "x");
+ size_t columnY=ds->addCopiedColumn(Y, "y");
+ size_t columnG=ds->addCopiedColumn(imageVector, "greyscaleImageData");
+ size_t columnS=ds->addCopiedColumn(pointSizes, "pointSizes");
+```
+
+Now we can use th datavectors to add a `JKQTPxyParametrizedScatterGraph`:
+```c++
+ JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
+ graph1->set_xColumn(columnX);
+ graph1->set_yColumn(columnY);
+ graph1->set_sizeColumn(columnS);
+ graph1->set_symbol(JKQTPfilledCircle);
+ graph1->set_colorColumn(columnG);
+ graph1->set_palette(JKQTPMathImageMATLAB);
+ graph1->set_drawLine(false);
+ graph1->set_title("");
+ plot.addGraph(graph1);
+```
+
+For illustrative purposes, the original image is shown at the bottom-left:
+```c++
+ JKQTPImage* graph2=new JKQTPImage(&plot);
+ graph2->set_image(image);
+ graph2->set_x(0);
+ graph2->set_y(0);
+ graph2->set_width(10);
+ graph2->set_height(10);
+ plot.addGraph(graph2);
+```
+
+Finally the plot is styled and the axis aspect ratios are fixed:
+```c++
+ // scale the plot so the graph is contained and format the coordinate system
+ plot.getXAxis()->set_axisLabel("x-axis");
+ plot.getYAxis()->set_axisLabel("y-axis");
+ plot.getXAxis()->set_drawGrid(false);
+ plot.getYAxis()->set_drawGrid(false);
+ // max. size is the size of the image
+ plot.setXY(0,image.width()-1,0,image.height()-1);
+ plot.setAbsoluteXY(0,image.width()-1,0,image.height()-1);
+ // ensure that axis aspect ration and coordinate system aspect ratio are maintained
+ plot.get_plotter()->set_maintainAspectRatio(true);
+ plot.get_plotter()->set_aspectRatio(1);
+ plot.get_plotter()->set_maintainAxisAspectRatio(true);
+ plot.get_plotter()->set_axisAspectRatio(1);
+```
+
+The full test appication combines all these variants and the result looks like this:
+
+![jkqtplotter_simpletest_paramscatterplot_image](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image.png)
+
+You can modify the example above in several ways, e.g. by choosing another symbol (e.g. a star):
+
+![jkqtplotter_simpletest_paramscatterplot_image_star](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_star.png)
+
+... or by changing the color palette and the symbol:
+
+![jkqtplotter_simpletest_paramscatterplot_image_palette](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette.png)
+
+![jkqtplotter_simpletest_paramscatterplot_image_palette_triangle](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_palette_triangle.png)
+
+... or even to set a different symbol for each pixel, based on the values in `columnS` (simply add `graph1->set_symbolColumn(columnS)`):
+
+
+![jkqtplotter_simpletest_paramscatterplot_image_varsymbol](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot_image_varsymbol.png)
+
+[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)
\ No newline at end of file
diff --git a/test/simpletest_paramscatterplot_image/example.bmp b/test/simpletest_paramscatterplot_image/example.bmp
new file mode 100644
index 0000000000..36229a82b7
Binary files /dev/null and b/test/simpletest_paramscatterplot_image/example.bmp differ
diff --git a/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp
new file mode 100644
index 0000000000..62dd0c1b25
--- /dev/null
+++ b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp
@@ -0,0 +1,86 @@
+#include
+#include "jkqtplotter/jkqtplotter.h"
+#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsimage.h"
+
+
+int main(int argc, char* argv[])
+{
+ QApplication app(argc, argv);
+
+ // 1. create a plotter window and get a pointer to the internal datastore (for convenience)
+ JKQtPlotter plot;
+ JKQTPdatastore* ds=plot.getDatastore();
+
+ // 2. Prepare Data
+ // 2.1 load image
+ QImage image(":/example.bmp");
+ QVector imageVector, pointSizes;
+ QVector X,Y;
+
+ // 2.2 convert image to greyscale, stored in a vector in row-major order
+ double maxSymbolSize=30; // maximal diameter of symbols in pt
+ for (int y=0; y(255-qGray(image.pixel(x,y)))/255.0*maxSymbolSize);
+ // calculate X/Y-coordinates (y mirrored, so image is upright)
+ X.push_back(x);
+ Y.push_back(image.height()-1-y);
+ }
+ }
+
+ // 2.3 and copy it to the datastore
+ size_t columnX=ds->addCopiedColumn(X, "x");
+ size_t columnY=ds->addCopiedColumn(Y, "y");
+ size_t columnG=ds->addCopiedColumn(imageVector, "greyscaleImageData");
+ size_t columnS=ds->addCopiedColumn(pointSizes, "pointSizes");
+
+ // 3. add graphs to plot
+ // 3.1 Now add a parametrized scatter graph with columnX, columnY for the positions of the
+ // scatter points, where the symbol size is given by column columnS and the color of
+ // each symbol is set from column columnG, via a color palette JKQTPMathImageMATLAB
+ JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
+ graph1->set_xColumn(columnX);
+ graph1->set_yColumn(columnY);
+ graph1->set_sizeColumn(columnS);
+ graph1->set_symbolColumn(columnS);
+ graph1->set_symbol(JKQTPfilledTriangle);
+ graph1->set_colorColumn(columnG);
+ graph1->set_palette(JKQTPMathImageOCEAN);
+ graph1->set_drawLine(false);
+ graph1->set_title("");
+ plot.addGraph(graph1);
+
+ // 3.2 add an image to display the original graphics
+ JKQTPImage* graph2=new JKQTPImage(&plot);
+ graph2->set_image(image);
+ graph2->set_x(0);
+ graph2->set_y(0);
+ graph2->set_width(10);
+ graph2->set_height(10);
+ plot.addGraph(graph2);
+
+
+ // 4. scale the plot so the graph is contained and format the coordinate system
+ plot.getXAxis()->set_axisLabel("x-axis");
+ plot.getYAxis()->set_axisLabel("y-axis");
+ plot.getXAxis()->set_drawGrid(false);
+ plot.getYAxis()->set_drawGrid(false);
+ // max. size is the size of the image
+ plot.setXY(0,image.width()-1,0,image.height()-1);
+ plot.setAbsoluteXY(0,image.width()-1,0,image.height()-1);
+ // ensure that axis aspect ration and coordinate system aspect ratio are maintained
+ plot.get_plotter()->set_maintainAspectRatio(true);
+ plot.get_plotter()->set_aspectRatio(1);
+ plot.get_plotter()->set_maintainAxisAspectRatio(true);
+ plot.get_plotter()->set_axisAspectRatio(1);
+
+ // 5. show plotter and make it a decent size
+ plot.show();
+ plot.resize(800,800);
+
+ return app.exec();
+}
diff --git a/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro
new file mode 100644
index 0000000000..2f72073baf
--- /dev/null
+++ b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.pro
@@ -0,0 +1,25 @@
+# source code for this simple demo
+SOURCES = jkqtplotter_simpletest_paramscatterplot_image.cpp
+
+RESOURCES += jkqtplotter_simpletest_paramscatterplot_image.qrc
+
+# configure Qt
+CONFIG += qt
+QT += core gui xml svg
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
+
+# output executable name
+TARGET = jkqtplotter_simpletest_paramscatterplot_image
+
+
+# include JKQtPlotter source code
+DEPENDPATH += . ../../lib
+INCLUDEPATH += ../../lib
+CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
+CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
+
+win32-msvc*: DEFINES += _USE_MATH_DEFINES
+
+# here you can activate some debug options
+#DEFINES += SHOW_JKQTPLOTTER_DEBUG
+#DEFINES += JKQTBP_AUTOTIMER
diff --git a/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.qrc b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.qrc
new file mode 100644
index 0000000000..77429e32a2
--- /dev/null
+++ b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.qrc
@@ -0,0 +1,5 @@
+
+
+ example.bmp
+
+
diff --git a/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image_and_lib.pro b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image_and_lib.pro
new file mode 100644
index 0000000000..da1c14ddb6
--- /dev/null
+++ b/test/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image_and_lib.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+
+SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_paramscatterplot_image
+
+jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro
+
+jkqtplotter_simpletest_paramscatterplot_image.file=$$PWD/jkqtplotter_simpletest_paramscatterplot_image.pro
+jkqtplotter_simpletest_paramscatterplot_image.depends = jkqtplotterlib