title: QCustomPlot colorMap; scale not updating for new data set
body: <p>I have a qCustomPlot colorMap, created in this way:</p>
  
  <pre><code>void MainWindow::plot_color_map(QCustomPlot *customPlot, cv::Mat image)
  cv::Mat rotated_matrix = cv::Mat(image.rows,image.cols,CV_64FC3);
  
  rotated_matrix.release();   
  rotate_90n(image,rotated_matrix,90);
  
  customPlot-&gt;clearGraphs();
  customPlot-&gt;clearPlottables();
  
  customPlot-&gt;axisRect()-&gt;setupFullAxesBox(true);
  customPlot-&gt;xAxis-&gt;setLabel("x");
  customPlot-&gt;yAxis-&gt;setLabel("y");
  customPlot-&gt;xAxis-&gt;setScaleRatio(customPlot-&gt;yAxis,1.0);
  
  QCPColorMap *colorMap = new QCPColorMap(customPlot-&gt;xAxis,customPlot-&gt;yAxis);
  customPlot-&gt;addPlottable(colorMap);
  
  colorMap-&gt;data()-&gt;setSize(rotated_matrix.rows,rotated_matrix.cols); 
  colorMap-&gt;data()-&gt;setRange(QCPRange(0,rotated_matrix.cols),QCPRange(0,rotated_matrix.rows)); 
  
  for(int col = 0; col &lt; rotated_matrix.cols; ++col) {
      for(int row = 0; row &lt; rotated_matrix.rows; row++) {
          colorMap-&gt;data()-&gt;setCell(row,col,rotated_matrix.at&lt;double&gt;(row,col));
      }
  }
  
  QCPColorScale *colorScale = new QCPColorScale(customPlot);
  
  double min,max;
  cv::minMaxLoc(rotated_matrix,&amp;min,&amp;max);
  qDebug() &lt;&lt; min &lt;&lt; " " &lt;&lt; max;
  customPlot-&gt;plotLayout()-&gt;addElement(0,1,colorScale);
  colorScale-&gt;setType(QCPAxis::atRight);
  colorMap-&gt;setColorScale(colorScale); 
  colorMap-&gt;setGradient(QCPColorGradient::gpJet);
  
  colorMap-&gt;rescaleDataRange();
  
  QCPMarginGroup *marginGroup = new QCPMarginGroup(customPlot);
  customPlot-&gt;axisRect()-&gt;setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup);
  colorScale-&gt;setMarginGroup(QCP::msBottom | QCP::msTop, marginGroup);
  
  customPlot-&gt;rescaleAxes();
  customPlot-&gt;replot();
  </code></pre>
  
  <p>The colorMap is displayed nicely and the scale range matches the "min" and "max" values that I output to the console.</p>
  
  <p>However if I then change the data in the cv::Mat image, the scale does not get updated.</p>
  
  <p>e.g if at first the data range is 0.2 to 7.3, no matter what data I choose to plot after that, the scale is stuck at 0.2 to 7.3, it does not change to reflect the new data set.</p>
  
  <p>Any ideas how to get the scale to auto update to match the data range?</p>
  
  <p>If I close and re-open the program, the first time the function is run, the scale is always correct, only after another image is plotted does it not change.</p>
  
  <p>Thanks 
  Mitch</p>