I have a problem updating a colormap. I successfully executed the example code but how can I change the type from gpThermal to gpHues for example ? And If I successfully changed the values in the cells of the colormap how do I rescale the color range and update the ticks on the right (let's say [-1 -> 1] TO [0 ->10] )

// configure axis rect:
customPlot->setInteractions(QCP::iRangeDrag|QCP::iRangeZoom); // this will also allow rescaling the color scale by dragging/zooming
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); // we want the color map to have nx * ny data points
colorMap->data()->setRange(QCPRange(-4, 4), QCPRange(-4, 4)); // and span the coordinate range -4..4 in both key (x) and value (y) dimensions
// now we assign some data, by accessing the QCPColorMapData instance of the color map:
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)+1e-2;
    z = 2*x*(qCos(r+2)/r-qSin(r+2)/r); // the B field strength of dipole radiation (modulo physical constants)
    colorMap->data()->setCell(xIndex, yIndex, z);
  }
}
 
// add a color scale:
QCPColorScale *colorScale = new QCPColorScale(customPlot);
customPlot->plotLayout()->addElement(0, 1, colorScale); // add it to the right of the main axis rect
colorScale->setType(QCPAxis::atRight); // scale shall be vertical bar with tick/axis labels right (actually atRight is already the default)
colorMap->setColorScale(colorScale); // associate the color map with the color scale
colorScale->axis()->setLabel("Magnetic Field Strength");
 
// set the color gradient of the color map to one of the presets:
colorMap->setGradient(QCPColorGradient::gpPolar);
// we could have also created a QCPColorGradient instance and added own colors to
// the gradient, see the documentation of QCPColorGradient for what's possible.
 
// rescale the data dimension (color) such that all data points lie in the span visualized by the color gradient:
colorMap->rescaleDataRange();
 
// make sure the axis rect and color scale synchronize their bottom and top margins (so they line up):
QCPMarginGroup *marginGroup = new QCPMarginGroup(customPlot);
customPlot->axisRect()->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
colorScale->setMarginGroup(QCP::msBottom|QCP::msTop, marginGroup);
 
// rescale the key (x) and value (y) axes so the whole color map is visible:
customPlot->rescaleAxes();

// After changing the cell values (I managed to do this):
// HOW TO rescale the color axis on the right and change the ticks to appropriate values ?
// Additionally: HOW TO change the type of the color scale for example to gpHues ?