aboutsummaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorSamuel Fadel <samuelfadel@gmail.com>2015-07-24 13:01:16 -0300
committerSamuel Fadel <samuelfadel@gmail.com>2015-07-24 13:01:16 -0300
commit6da67a32e56c101b9334d2c6f33bd5238d082330 (patch)
tree87d6f4dbc4b1d926be75c432ede2578ab45d8b33 /main.cpp
parentb7e1060b7cb71b30b91cc65c011b719e255c0a06 (diff)
Color mapping in Scatterplot and initial measures.
- Scatterplot: can now map any floating point data to colors; - Scatterplot: somewhat optimized geometry/material updates; - Removed anything related to labels where it was not necessary; - Added observers to implement distortion (via measures) visualization; - Added skeleton implementations of NP and silhouette.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/main.cpp b/main.cpp
index 84579b5..70499e7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -8,6 +8,8 @@
#include "mp.h"
#include "scatterplot.h"
#include "interactionhandler.h"
+#include "distortionobserver.h"
+#include "npdistortion.h"
int main(int argc, char **argv)
{
@@ -35,21 +37,27 @@ int main(int argc, char **argv)
arma::uvec sampleIndices = arma::randi<arma::uvec>(subsampleSize, arma::distr_param(0, n-1));
arma::mat Ys(subsampleSize, 2, arma::fill::randn);
Ys = mp::forceScheme(mp::dist(X.rows(sampleIndices)), Ys);
- arma::mat subsampleData(subsampleSize, 3);
- subsampleData.cols(0, 1) = Ys;
- subsampleData.col(2) = labels(sampleIndices);
Scatterplot *subsamplePlot = engine.rootObjects()[0]->findChild<Scatterplot *>("subsamplePlot");
subsamplePlot->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton);
- subsamplePlot->setData(subsampleData);
+ subsamplePlot->setXY(Ys);
+ subsamplePlot->setColorData(labels(sampleIndices));
Scatterplot *plot = engine.rootObjects()[0]->findChild<Scatterplot *>("plot");
// connect both plots through interaction handler
- InteractionHandler interactionHandler(X, labels, sampleIndices);
- QObject::connect(subsamplePlot, SIGNAL(dataChanged(const arma::mat &)),
+ InteractionHandler interactionHandler(X, sampleIndices);
+ QObject::connect(subsamplePlot, SIGNAL(xyChanged(const arma::mat &)),
&interactionHandler, SLOT(setSubsample(const arma::mat &)));
QObject::connect(&interactionHandler, SIGNAL(subsampleChanged(const arma::mat &)),
- plot, SLOT(setData(const arma::mat &)));
+ plot, SLOT(setXY(const arma::mat &)));
+
+ // TODO: works; though it needs measures implementation
+ // std::unique_ptr<DistortionObserver> distortionObs(new NPDistortion(X, sampleIndices));
+ // QObject::connect(&interactionHandler, SIGNAL(subsampleChanged(const arma::mat &)),
+ // distortionObs.get(), SLOT(setMap(const arma::mat &)));
+ // QObject::connect(distortionObs.get(), SIGNAL(mapChanged(const arma::vec &)),
+ // plot, SLOT(setColorData(const arma::vec &)));
+
interactionHandler.setSubsample(Ys);
return app.exec();