#include "derrep2014qplot.h" #include "DEC-0.0/processor/Settings.h" static const int TOP_OFFSET = 100; static const int LINE_THICKNESS = 2; DerRep2014QPlot::DerRep2014QPlot(QWidget *parent) : QWidget(parent) { } void DerRep2014QPlot::drawGraphics(QCustomPlot *customPlot) { customPlot->legend->clearItems(); customPlot->clearGraphs(); customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); customPlot->addGraph(); customPlot->addGraph(); customPlot->graph(0)->setData(Settings::generations, Settings::ancientCommonSize); customPlot->graph(0)->setPen(QPen(Qt::blue, LINE_THICKNESS)); customPlot->graph(0)->setName("AncientCommonPopSize"); customPlot->graph(1)->setData(Settings::generations, Settings::homoCommonSize); customPlot->graph(1)->setPen(QPen(Qt::red, LINE_THICKNESS)); customPlot->graph(1)->setName("HomoCommonPopSize"); customPlot->legend->setVisible(true); QFont legendFont = font(); legendFont.setPointSize(8); customPlot->legend->setFont(legendFont); customPlot->axisRect()->insetLayout()->setInsetAlignment(0, Qt::AlignTop | Qt::AlignRight); customPlot->xAxis->setRange(0, Settings::globalGenerations + TOP_OFFSET); customPlot->yAxis->setRange(0, Settings::maxYval + TOP_OFFSET); customPlot->xAxis->setLabel("Generations"); customPlot->yAxis->setLabel("popSize"); customPlot->replot(); } void DerRep2014QPlot::drawSepGenderGraphics(QCustomPlot *customPlot) { customPlot->legend->clearItems(); customPlot->clearGraphs(); customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables); customPlot->addGraph(); customPlot->addGraph(); customPlot->addGraph(); customPlot->addGraph(); customPlot->graph(0)->setData(Settings::generations, Settings::ancientMaleSize); customPlot->graph(0)->setPen(QPen(Qt::blue, LINE_THICKNESS)); customPlot->graph(0)->setName("AncientMalePopSize"); customPlot->graph(1)->setData(Settings::generations, Settings::ancientFemaleSize); customPlot->graph(1)->setPen(QPen(Qt::magenta, LINE_THICKNESS)); customPlot->graph(1)->setName("AncientFemalePopSize"); customPlot->graph(2)->setData(Settings::generations, Settings::homoMaleSize); customPlot->graph(2)->setPen(QPen(Qt::red, LINE_THICKNESS)); customPlot->graph(2)->setName("HomoMalePopSize"); customPlot->graph(3)->setData(Settings::generations, Settings::homoFemaleSize); customPlot->graph(3)->setPen(QPen(Qt::yellow, LINE_THICKNESS)); customPlot->graph(3)->setName("HomoFemalePopSize"); //customPlot->xAxis->setRange(0, Settings::globalGenerations + TOP_OFFSET); //customPlot->yAxis->setRange(0, Settings::maxYval + TOP_OFFSET); customPlot->rescaleAxes(); customPlot->xAxis->setLabel("Generations"); customPlot->yAxis->setLabel("popSize"); customPlot->replot(); }