Hello, I wrote this macro starting from an old macro that I wrote with @couet 's help
I should get something like this
i.e. the green and orange box, and the red horizontal and vertical lines but, as you see, in the following plot, I don’t get them
histodrawbgk.cpp (2.4 KB)
Histo.root (10.4 KB)
I did not look at your macro but, from the plots you posted, I see that the axis coordinates are very different in the new plot. Are you sure the boxes and lines drawn in your macro have the correct coordinates in the new axis system?
Hi @cout yes, the axes range are different because they are not same data (!
And yes, I changed the coordinates of lines and boxes in the macro
auto b1 = new TBox(x1,0,x2,30);
auto b2 = new TBox(tpeakmin,0,tpeakmax,30);
auto lh = new TLine(tpeakmin,30,tpeakmax,30);
auto lv1 = new TLine(tpeakmin,1,tpeakmin,200000);
auto lv2 = new TLine(tpeakmax,1,tpeakmax,200000);
Your histo is not transparent, and the Draw order matters.
You should draw the histogram first … it defines the coordinates:
TCanvas *c01 = new TCanvas("c01","histo",1280,1024);
Thank you the both @couet and @dastudillo that was the problem.
I’ve last question
I set the x range
but it looks like that the plot starts before than 1660
histodrawbgk.cpp (2.6 KB)
I guess you should use SetRangeUser instead.
Thank you @couet
using SetRangeUser it solved!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.