Nel*_*onR 3 c++ qt axis qt5 qcustomplot
我正在使用QCustomPlotQt来绘制视频序列的各个方面.
我想定义图表的背景,以便定义我的特定区域yAxis.我的图是这样的:

我想在我的定义间隔yAxis得到这样的东西:

最后一张图片属于一个名为PEAT的程序,用于分析可触发癫痫发作的视频.我指的是他们沿着区域定义区域的方式yAxis.
有什么建议?
要在图中添加区域,可以添加两个图形来定义区域的边界:
//Upper bound
customPlot->addGraph();
QPen pen;
pen.setStyle(Qt::DotLine);
pen.setWidth(1);
pen.setColor(QColor(180,180,180));
customPlot->graph(0)->setName("Pass Band");
customPlot->graph(0)->setPen(pen);
customPlot->graph(0)->setBrush(QBrush(QColor(255,50,30,20)));
//Lower bound
customPlot->addGraph();
customPlot->legend->removeItem(customPlot->legend->itemCount()-1); // don't show two Band graphs in legend
customPlot->graph(1)->setPen(pen);
Run Code Online (Sandbox Code Playgroud)
接下来,您可以使用setChannelFillGraph以下方法填充边界之间的区域:
customPlot->graph(0)->setChannelFillGraph(customPlot->graph(1));
Run Code Online (Sandbox Code Playgroud)
另外,不要忘记为边界分配相关值:
QVector<double> x(250);
QVector<double> y0(250), y1(250);
for (int i=0; i<250; ++i)
{
x[i] = i ;
y0[i] = upperValue;
y1[i] = lowerValue;
}
customPlot->graph(0)->setData(x, y0);
customPlot->graph(1)->setData(x, y1);
Run Code Online (Sandbox Code Playgroud)
您还可以添加其他图形以显示某些边界,例如示例中的边界.