Beispiel #1
0
void Snakes::drawPlot(std::vector<double> inputX, std::vector<double> inputY) {

	QCustomPlot *customPlot = new QCustomPlot();
	customPlot->resize(500, 500);
	
	QVector<double> x = QVector<double>::fromStdVector(inputX);
	QVector<double> y = QVector<double>::fromStdVector(inputY);

	customPlot->addGraph();
	customPlot->graph(0)->setData(x, y);
	customPlot->xAxis->setLabel("x");
	customPlot->yAxis->setLabel("y");
	customPlot->xAxis->setRange(inputX.front(), inputX.back());
	customPlot->yAxis->setRange(inputY.front(), inputY.back());
	customPlot->replot();

	customPlot->show();
}