Dear experts,
I am preparing GUI application based on Qt 5.15.2, ROOT 6.28.04, using QtWebEngine and object from ROOT::Experimental (RCanvas, RH1D, etc.). I found that the horizontal line for y=0 is drawn if data has also negative y-values. Is it possible to remove/hide this line using new approach of “R” classes? (I know that using “TH1D” with draw options it is possible). Also I see the problem that the “line” object of the line y=0 is shared with histogram, thus if I change histogram line color, the y=0 line change color too.
I have prepared a simple example showing two frames. One is empty with axes drawn. In second frame the RH1D is drawn. How to draw RH1D object in the first frame without horizontal y=0 line? Thank you.
#include "ROOT/RHist.hxx"
#include "ROOT/RHistDrawable.hxx"
#include "ROOT/RFrameTitle.hxx"
#include "ROOT/RCanvas.hxx"
#include "ROOT/RPad.hxx"
#include "TRandom.h"
// macro must be here while cling is not capable to load
// library automatically for outlined function see ROOT-10336
R__LOAD_LIBRARY(libROOTHistDraw)
using namespace ROOT::Experimental;
void rhist01()
{
RAxisConfig xaxis(5, 0., 5.);
auto pHist = std::make_shared<RH1D>(xaxis);
pHist->GetImpl()->AddBinContent(1, -3);
pHist->GetImpl()->AddBinContent(2, 2);
pHist->GetImpl()->AddBinContent(3, 8);
pHist->GetImpl()->AddBinContent(4, 5);
pHist->GetImpl()->AddBinContent(5, -1);
auto canvas = RCanvas::Create("zero");
auto pads = canvas->Divide(2,1);
auto pad1 = pads[0][0];
auto pad2 = pads[1][0];
auto frame1 = pad1->AddFrame();
frame1->drawAxes = true;
frame1->x.SetMinMax(0, 5);
frame1->y.SetMinMax(-5, 10);
pad1->Draw<RFrameTitle>("frame 1");
auto frame2 = pad2->AddFrame();
frame2->drawAxes = true;
frame2->x.SetMinMax(0, 5);
frame2->y.SetMinMax(-5, 10);
pad2->Draw<RFrameTitle>("frame 2");
auto draw = pad2->Draw(pHist);
draw->line.color = RColor::kGreen;
canvas->SetSize(800, 500);
canvas->Show();
}
ROOT Version: 6.28/04
Platform: x86_64 GNU/Linux Ubuntu 22.04
Compiler: gcc 11.3 (c++17)