From ff3f94e0def0808cf85e22ea6c0f4e4418b51fcc Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Mon, 8 Apr 2024 20:51:57 -0400 Subject: [PATCH] bug fix Histogram2D.h; now no data is white, at least one data is non-white --- Histogram2D.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Histogram2D.h b/Histogram2D.h index a188f4b..54ca5a6 100644 --- a/Histogram2D.h +++ b/Histogram2D.h @@ -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(); }