bug fix Histogram2D.h; now no data is white, at least one data is non-white

This commit is contained in:
Ryan Tang 2024-04-08 20:51:57 -04:00
parent 8a0503629c
commit ff3f94e0de

View File

@ -292,7 +292,11 @@ inline void Histogram2D::Fill(double x, double y){
if( xk == 1 && yk == 1 ) {
double value = colorMap->data()->cell(xIndex, yIndex);
colorMap->data()->setCell(xIndex, yIndex, value + 1);
if( std::isnan(value) ){
colorMap->data()->setCell(xIndex, yIndex, 1);
}else{
colorMap->data()->setCell(xIndex, yIndex, value + 1);
}
for( int i = 0; i < cutList.count(); i++){
if( cutList[i].isEmpty() ) continue;
@ -346,6 +350,11 @@ inline void Histogram2D::Clear(){
colorMap->data()->clear();
colorMap->data()->setSize(xBin, yBin);
colorMap->data()->setRange(QCPRange(xMin, xMax), QCPRange(yMin, yMax));
for( int i = 0; i < xBin; i++){
for( int j = 0; j < yBin; j++){
colorMap->data()->setCell(i, j, NAN);
}
}
UpdatePlot();
}