Hi guys,
I’ve tried to fix an axis in an animation, but I couldn’t. Can you tell me what is the trouble and how to solve it?
Thanks in advance.
Processor p;
TCanvas* c1 = new TCanvas ("c1","",1000,1000);
c1->cd();
int Steps=30, k;
double a = 0, b = 0, c=0;
TH1D * h2 = p.SaveInTH1(argv[1],"Simulation");
for(k, a=0 ; k<=Steps; a+=100, k++ )
{
TH1D *h2c= p.Calibrate(h2, "", 1, a);
h2c->GetXaxis()->SetLimits(0, 6000);
h2c->GetXaxis()->SetRangeUser(0, 6000);
h2c->Draw();
c1->Print("animation.gif+50");
}
couet
February 13, 2017, 7:39am
2
As I understand it you need to have fix units and plot the histogram inside. May my the simplest will be to
Draw first your units frame using gPad->DrawFame(); and then draw the histogram using option SAME.
for(k, a=0 ; k<=Steps; a+=100, k++ )
{
TH1D *h2c= p.Calibrate(h2, "", 1, a);
gPad->DrawFrame(0.,0.,6000.,1200.);
gPad->Modified();
h2c->Draw("SAME");
c1->Print("animation.gif+50");
}
It is working how I was spectating. However I couldn’t set the titles in the axis with the traditional
h2c->GetYaxis()->SetTitle(titley);
h2c->GetYaxis()->CenterTitle();
h2c->GetXaxis()->SetTitle(titlex);
h2c->GetXaxis()->CenterTitle();
couet
February 14, 2017, 8:17am
4
TH1F *frame = gPad->DrawFrame(0.,0.,6000.,1200.);
frame->GetYaxis()->CenterTitle();
frame->GetXaxis()->SetTitle(titlex);
frame->GetXaxis()->CenterTitle();