Re: ROOT Axis Ticks

Rene Brun (Rene.Brun@cern.ch)
Fri, 14 Nov 1997 09:01:04 +0100


Peter Wienemann wrote:

> Hi Rene!
>
> If I use the "solid" fill style for histograms, the axis ticks
> always vanish in the region of the histogram where it is filled.
> I attached an example for this behavior.
> This is quite annoying if you want to fix cuts.
>
> Is there a way to make the ticks visible again?
>

Here is a small macro RedrawAxis.C to do this job.
I will add a new member function TPad::RedrawAxis
in the next version.

Rene Brun

//-----------------------macro RedrawAxis.C-----------------------
{
// This macro is an example showing how to redraw the frame axis
// Redrawing axis may be necessary in case of superimposed histograms
// when one or more histograms have a fill color
//
TGaxis *axis = new TGaxis();
Float_t xmin,ymin,xmax,ymax);
gPad->GetRangeAxis(xmin,ymin,xmax,ymax);
// redraw x axis
if (!gPad->GetLogx()) axis->DrawAxis(xmin,ymin,xmax,ymin,xmin,xmax);
else axis->DrawAxis(xmin,ymin,xmax,ymin,
TMath::Power(10,xmin),TMath::Power(10,xmax),510,"G");
// redraw y axis
if (!gPad->GetLogy()) axis->DrawAxis(xmin,ymin,xmin,ymax,ymin,ymax);
else axis->DrawAxis(xmin,ymin,xmin,ymax,
TMath::Power(10,ymin),TMath::Power(10,ymax),510,"G");

}