Good day I just want to come back to the problem, which I faced 1 month ago. Though I thought it was solved, still it seems not completely. When I try to build a colormap it looks very nice and exactly what I would like it to be, see: https://www.dropbox.com/s/uq43gool44cyrly/fig1.png?dl=0 (random numbers from 0 to 1e5) . Still the colors sometimes doesn't match the colorscale, so in fig1 for example the cell (0,4) with a value 88569 should be orange, but is yellow... What am I doing wrong? May be oldfashioned filling with QCPItemRects could be a better solution in this case? Below is a code:

void MainWindow::setupColormapDemo(QCustomPlot *customPlot)
{
    int nx=55, ny=25;

         customPlot->axisRect()->setupFullAxesBox(true);
         customPlot->yAxis->setLabel("Y, cm");
         customPlot->xAxis->setLabel("X, cm");
         customPlot->xAxis->setRange(-3500, 2000);
         customPlot->yAxis->setRange(-500, 2000);

         QCPColorMap *Colormap = new QCPColorMap (customPlot-> xAxis, customPlot-> yAxis);
         Colormap-> data () -> setSize (nx, ny);
         Colormap-> data () -> setRange (QCPRange (-3500 + 50, 1900 + 50), QCPRange (-500 + 50, 1900 + 50));
         Colormap-> setInterpolate (false);
         Colormap-> setTightBoundary(false);

 //       customPlot->rescaleAxes();

         for (int y = 0; y < ny; ++y)
         {
             for (int x = 0; x < nx; ++x)
             {
                 double z = QRandomGenerator::global()->generateDouble();
                 qDebug()<<"{"<<x<<","<<y<<","<<z<<"}";
                              if (z) Colormap-> data () -> setCell (x, y, z*1e5);
                              else Colormap-> data () -> setAlpha (x, y, 0);
             }
         }

        QCPColorScale *colorScale = new QCPColorScale (customPlot);
        colorScale-> setType (QCPAxis :: atBottom);
        customPlot-> plotLayout () -> addElement (1, 0, colorScale);
        QCPRange range(0.0,1e5);
     //   colorScale->axis()->setRange(range);
        colorScale->setDataRange(range);
        colorScale->axis()->setPadding(10);
        colorScale->axis()->setNumberPrecision(0);
        colorScale->axis()->setNumberFormat("eb");

        QCPColorGradient gradient;
        QVector<QColor> mycolorsset1; mycolorsset1.append(QColor(255, 255, 255)); mycolorsset1.append(QColor(253, 105, 253));
        mycolorsset1.append(QColor(181, 0, 255));mycolorsset1.append(QColor(6, 0, 204)); mycolorsset1.append(QColor(0, 147, 255));
        mycolorsset1.append(QColor(0, 179, 132));mycolorsset1.append(QColor(124, 254, 1));mycolorsset1.append(QColor(254, 255, 0));
        mycolorsset1.append(QColor(255, 129, 0));mycolorsset1.append(QColor(200, 0, 0));mycolorsset1.append(QColor(0, 0, 0));

        gradient.clearColorStops(); gradient.setLevelCount(10);

        for(int i=0;i<10;++i)
        { gradient.setColorStopAt((double)i/9, mycolorsset1[i]);    }

        QSharedPointer<QCPAxisTicker> logTicker(new QCPAxisTicker);
        colorScale->axis()->setTicker(logTicker);
        logTicker->setTickOrigin(0.0);
        logTicker->setTickCount(5);

 //  Colormap->setGradient(gradient);
   colorScale->setGradient(gradient);
   Colormap->setColorScale(colorScale);

   //connect(Colormap, SIGNAL(gradientChanged(QCPColorGradient)),Colormap,SLOT(setGradient(QCPColorGradient)));

   QCPMarginGroup *marginGroup = new QCPMarginGroup(customPlot);
   customPlot->axisRect()->setMarginGroup(QCP::msLeft | QCP::msRight, marginGroup);
   colorScale->setMarginGroup(QCP::msLeft | QCP::msRight, marginGroup);
    customPlot->replot();
}

to read out values I use:

void MainWindow::showPointToolTip1(QMouseEvent *event)
{
   auto *Colormap = static_cast<QCPColorMap *>(ui->customPlot->plottable(0));

    int x = ui->customPlot->xAxis->pixelToCoord(event->pos().x());
    int y = ui->customPlot->yAxis->pixelToCoord(event->pos().y());
   // double zz=ui->customPlot->plottable(1)->data()->data(x,y);
    double z=0;
    z=Colormap->data()->data(x,y);
    ui->customPlot->setToolTip(QString("(%1 , %2, %3)").arg(x).arg(y).arg(z));
}