Histogram2D can logZ

This commit is contained in:
carina@hades 2023-12-14 15:52:36 -05:00
parent d90dd4920f
commit dc93fba711

View File

@ -29,6 +29,7 @@ public:
isChannelMap = false; isChannelMap = false;
tickStep = 1; // only used when isChannelMap = true tickStep = 1; // only used when isChannelMap = true
isLogZ = false;
axisRect()->setupFullAxesBox(true); axisRect()->setupFullAxesBox(true);
xAxis->setLabel(xLabel); xAxis->setLabel(xLabel);
@ -230,6 +231,7 @@ private:
bool isChannelMap; bool isChannelMap;
int tickStep; int tickStep;
bool isLogZ;
QCPColorMap * colorMap; QCPColorMap * colorMap;
QCPColorScale *colorScale; QCPColorScale *colorScale;
@ -398,6 +400,7 @@ inline void Histogram2D::rightMouseClickMenu(QMouseEvent * event){
menu->setAttribute(Qt::WA_DeleteOnClose); menu->setAttribute(Qt::WA_DeleteOnClose);
QAction * a1 = menu->addAction("UnZoom"); QAction * a1 = menu->addAction("UnZoom");
QAction * a6 = menu->addAction("Set/UnSet Log-Z");
QAction * a2 = menu->addAction("Clear hist."); QAction * a2 = menu->addAction("Clear hist.");
QAction * a3 = menu->addAction("Toggle Stat."); QAction * a3 = menu->addAction("Toggle Stat.");
QAction * a4 = menu->addAction("Rebin (clear histogram)"); QAction * a4 = menu->addAction("Rebin (clear histogram)");
@ -458,6 +461,17 @@ inline void Histogram2D::rightMouseClickMenu(QMouseEvent * event){
return; 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 ") ){ if( selectedAction && numCut > 0 && selectedAction->text().contains("Delete ") ){
QString haha = selectedAction->text(); QString haha = selectedAction->text();