On Fri, 7 Jan 2005, Gero Flucke wrote:
> Hi,
> when using the gPad->RedrawAxis() the result on screen and in .ps
> output is ugly, look at the axis labels and titles in the attached
> script/postcript.
> I suppose that it comes from the fact that they are twice drawn upon each
> other, but not exactly at the same position.
> The printout of the .ps seems to be fine again, but I'd like the people to
> look at them on the screen as well...
>
> Is there something else I can do apart from editing the .ps?
Hi,
I myself found a solution. Instead of gPad->RedrawAxis() I directly draw
TGaxis with the option "U" to skip the labels. But it is not very
convenient since I have to figure out the correct coordinates to place the
axes and my solution requires that for log scales I define the minium of
the histogram via hist->SetMinimum() since I was not able to figure it out
otherwise (I have to define the coordinates before I draw the first
histogram since I pass a list of objects to my drawing mechanism, so I
cannot use conversion between different coordinates systems provided by
gPad). So I do
TH1 *h = ... //1D-hist
Bool_t log = ... // whether y-axis will be set to log scale or not
const Float_t xMin = hD->GetXaxis()->GetXmin(); const Float_t xMax = hD->GetXaxis()->GetXmax(); const Float_t yMin = (log ? h->GetMinimum() : TMath::Min(0.,h->GetMinimum())); const Float_t yMax = h->GetMaximum();
TGaxis *xAxis = new TGaxis(xMin, yMin, xMax, yMin, xMin, xMax, 510, "U"); TGaxis *yAxis = new TGaxis(xMin, yMin, xMin, yMax, yMin, yMax, 510,
(log ? "UG" : "U"));
// <skip a lot, pass the stuff to other methods etc.>
h->Draw();
if(log) gPad->SetLogy();
xAxis->Draw();
yAxis->Draw();
Any comment what to improve/generalise?
Cheers
Gero
-- ----------------------------------------------------------------------- Gero Flucke DESY Notkestr. 85 22607 Hamburg +49-(0)40-8998-2454Received on Mon Jan 10 2005 - 10:34:54 MET
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:04 MET