记录下QCustomPlot 热力图的用法
// configure axis rect:配置轴矩形
customPlot->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); // 这也将允许通过拖拽/缩放尺度改变颜色范围
customPlot->axisRect()->setupFullAxesBox(true);
customPlot->xAxis->setLabel("x");
customPlot->yAxis->setLabel("y");
// set up the QCPColorMap:
QCPColorMap *colorMap = new QCPColorMap(customPlot->xAxis, customPlot->yAxis);
int nx = 200;
int ny = 200;
colorMap->data()->setSize(nx, ny); // 我们希望彩色地图有nx*ny的数据点
colorMap->data()->setRange(QCPRange(-4, 4), QCPRange(-4, 4)); // 并在键(x)和值(y)维上跨越坐标范围-4..4
// :现在,我们通过访问颜色贴图的QCPColorMapData实例来分配一些数据:
double x, y, z;
for (int xIndex=0; xIndex<nx; ++xIndex)
{
for (int yIndex=0; yIndex<ny; ++yIndex)
{
colorMap->data()->cellToCoord(xIndex, yIndex, &x, &y);
double r = 3*qSqrt(x*x+y*y)+