我试图裁剪我的数据,并只复制图的选定部分,但在复制之后,x轴仍然具有相同的值,并且我的图从(0,0)开始,而不是(cropped_starting_value_x,y)。如何重置X轴的值?我已经尝试过重新扫描,但它不起作用。这里我只有19秒左右的数值。
QCPGraph *mainGraph = Customplott[0]->addGraph();
QCPGraph *SecondaryGraph = Customplott[0]->addGraph();
//QCPGraph *TertiaryGraph = Customplott[Number]->addGraph();
//mainGraph->setAdaptiveSampling(true);
mainGraph->setData(Time_temp, Measured_temp);
mainGraph->setScatterStyle(QCPScatterStyle(QCPScatterStyle::ssNone, QPen(Qt::red), QBrush(Qt::white), 3));
mainGraph->setPen(QPen(Qt::blue)); // Magic only happens, when line width == 1
SecondaryGraph->setData(Time_temp, Output_temp);
SecondaryGraph->setPen(QPen(Qt::red));
Customplott[0]->setObjectName("YawRate");
Customplott[0]->xAxis->setLabel("Time [s]");
Customplott[0]->yAxis->setLabel("Yaw Rate");
/* rescale axes according to graph's data */
Customplott[0]->rescaleAxes();
mainGraph->rescaleAxes();
SecondaryGraph->rescaleAxes(true);
Customplott[0]->replot();
我们非常感谢您的每一种帮助!
您应该使用以下方法:
Customplott[0]->xAxis->setRange(minX, maxX);
(此处为文档)