From dc93fba711232d795367e3897509d6d597df1bf5 Mon Sep 17 00:00:00 2001 From: "carina@hades" Date: Thu, 14 Dec 2023 15:52:36 -0500 Subject: [PATCH] Histogram2D can logZ --- Histogram2D.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Histogram2D.h b/Histogram2D.h index 5e30e1e..d134f54 100644 --- a/Histogram2D.h +++ b/Histogram2D.h @@ -29,6 +29,7 @@ public: isChannelMap = false; tickStep = 1; // only used when isChannelMap = true + isLogZ = false; axisRect()->setupFullAxesBox(true); xAxis->setLabel(xLabel); @@ -230,6 +231,7 @@ private: bool isChannelMap; int tickStep; + bool isLogZ; QCPColorMap * colorMap; QCPColorScale *colorScale; @@ -398,6 +400,7 @@ inline void Histogram2D::rightMouseClickMenu(QMouseEvent * event){ menu->setAttribute(Qt::WA_DeleteOnClose); QAction * a1 = menu->addAction("UnZoom"); + QAction * a6 = menu->addAction("Set/UnSet Log-Z"); QAction * a2 = menu->addAction("Clear hist."); QAction * a3 = menu->addAction("Toggle Stat."); QAction * a4 = menu->addAction("Rebin (clear histogram)"); @@ -458,6 +461,17 @@ inline void Histogram2D::rightMouseClickMenu(QMouseEvent * event){ return; } + if( selectedAction == a6){ + if( !isLogZ ){ + colorMap->setDataScaleType(QCPAxis::stLogarithmic); + isLogZ = true; + }else{ + colorMap->setDataScaleType(QCPAxis::stLinear); + isLogZ = false; + } + replot(); + } + if( selectedAction && numCut > 0 && selectedAction->text().contains("Delete ") ){ QString haha = selectedAction->text();