Hi Pietro,
Try this:
{
TCanvas *c1 = new TCanvas("c1","Test",0,0,600,600);
hi=new TH1F("Axis","Axis",10,0,15);
hi->Draw();
c1->Update();
TGaxis axis(gPad->GetUxmax(),
gPad->GetUymin(),
gPad->GetUxmax(),
gPad->GetUymax(),0,10,510,"");
axis.SetLineColor(1);
axis.SetTextColor(1);
axis.Draw();
}
Cheers, Olivier
On Mon, 1 Sep 2003, Pietro Govoni wrote:
> dear rooters,
> I am trying to draw an additional axis to an existing hisotgram, following
> the example given in the tutorials.
> I cut and pasted the code and put it into my executable, that links the
> libraries from:
>
> /afs/cern.ch/sw/root/v3.05.07/rh73_gcc296/root
>
> I don't have any problems in compiling nor running the code, but, even if
> I put in the code:
>
> TGaxis axis(gPad->GetUxmax(), gPad->GetUymin(),
> gPad->GetUxmax(),
> gPad->GetUymax(),0,extremes[sensIndex->second][1],510,"+R");
> axis.SetLineColor(1);
> axis.SetTextColor(1);
> axis.Draw();
>
> the additional axis is not drawn in the pad.
> If I remove all the plots before the axis's one, then the axis alone is
> plotted without any problem.
>
> Is there anything that I am missing?
>
> Thank you very much
>
> pietro
>
>
--
Org: CERN - European Laboratory for Particle Physics.
Mail: 1211 Geneve 23 - Switzerland Mailbox: J25910
E-Mail: Olivier.Couet@cern.ch Phone: +41 22 7676522
WWW: http://cern.ch/Olivier.Couet/ Fax: +41 22 7677155
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET