RE: [PATCH] enlarge TGraph enclosing rectangle correctly when drawing log scale

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Thu, 12 May 2005 11:26:10 +0200


Hi Roland,

Can you send a small example macro allowing us to see what improvements your patch provides ?

Cheers, Olivier

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910

E-Mail: Olivier.Couet_at_cern.ch                            Phone:   +41 22
7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22
7670300

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch
[mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Roland Kuhn
Sent: Wednesday, May 11, 2005 10:37 PM
To: roottalk
Subject: [ROOT] [PATCH] enlarge TGraph enclosing rectangle correctly
when drawing log scale

Hi!

When drawing a graph, the enclosing rectangle given by ComputeRange() is
enlarged by 10% on all sides. However, when one axis is set to log
scale, that is not correctly taken into account: usually the left edge
will end up negative, so it is set to 0.9*rwxmin instead of enlarging
the distance to the right edge by 10% (dividing by the 10th root of
rwxmax/rwxmin); the right edge ends up being roughly 10% larger than
rwxmax.

Let me give an illustrative example:

Suppose you want to plot logarithmically over an x_Bjorken range from
10^-10 to 1 (values not chosen from a running experiment ;-) ). The
current implementation will yield a range [9*10^-11, 1.1], while the
correct range would be [10^-11, 10]. "Correct" means, that the
logarithmic plot will have a 10% visual margin, exactly like the linear
plot would have.

The attached patch fixes the problem in TGraph and derivates, but I'm
not sure if the problem exists also in other places inside ROOT.

Ciao,
					Roland
Received on Thu May 12 2005 - 11:27:05 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:07 MET