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

From: Roland Kuhn <rkuhn_at_e18.physik.tu-muenchen.de>
Date: Wed, 11 May 2005 22:37:15 +0200


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.



TU Muenchen, Physik-Department E18, James-Franck-Str. 85747 Garching
Telefon 089/289-12592; Telefax 089/289-12570
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on a mailing list?

Version: 3.12
GS/CS/M/MU d-(++) s:+ a-> C+++ UL++++ P-(+) L+++ E(+) W+ !N K- w--- M+ 
!V Y+
PGP++ t+(++) 5 R+ tv-- b+ DI++ e+++>++++ h---- y+++

  • application/octet-stream attachment: patch
Received on Wed May 11 2005 - 22:38:04 MEST

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