Re: [ROOT] TF1 and TF2 in TH2

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Fri Feb 21 2003 - 10:26:06 MET


 Hi Berrie,

  What you see is normal. I have put in attachment a modified version of
your macro. In addition to the contour plots, it also draws in a color
plot and the two diagonals of the pad. The color plot is done with boxes,
one for each bin. The boxes colors depend on the bin content.
  On the first plot (c1) the boxes are squares because the number of bins 
along X and Y are the same and the pad is a square, whereas on the second 
plot (c2) the boxes are rectangles because a zoom has been done along the 
Y dimension.

 What is important to notice is:

- on both plots the diagonals lines pass through all the vertexes of the
  boxes laying on the pad's diagonal.

- on both plots the contour plot is exactly around the color plot at the
  same relative position.

 So both plots are correct and the asymmetry you see is just a visual
effect because you assume that on both plot the limits of the ellipses
represent the same data point, which is wrong. Because the boxes are
stretched along the Y axis the ellipses are distorted and the new
ellipses' extremities don't represent the same data point as before.

 In the macro I have also labeled two points. As you can see, because of 
the stretching along the Y axis, "Point 2" in the canvas c2 appears to be 
the extremity of the ellipse whereas it was not in canvas c1.
If you look at the color plots (boxes) there is no ambiguities. 
But I agree with you that looking at the ellipses *only* can be very 
misleading !

 You can try to grow and shrink the pad and you will see that the 
"symmetry you expected" comes back when the boxes are again squares.

To avoid that bad visual effect with contour plots, I would recommend you
to make sure to keep the same ratio between X an Y Axis to ensure that the
boxes will remain squares.

 I hope my explanations are clear enough ... :-)

 Olivier

PS: Sorry for the late answer but the reply I send yesterday content a gif 
    file (to explain the problem) which was too big for the mailing list.

On Thu, 20 Feb 2003, Berrie Giebels wrote:

> 
> Hi rooters, my problem is visible in the attached macro. I plot a TF2 as a
> contour in a TH2, and then draw the symmetry axis on top of it using a
> TF1. As you can see in canvas c1, all is ok. Now in canvas c2 where I used
> a differently binned TH2 the TF1 is no longer on the TF2 axis.
> 
> Also, just zoom in on the [-4,4] Y range in c1 and you'll see the line no
> longer being on the symmetry axis of the TF2.
> 
> What is going on? What should I do so that plotting the TF1 on the TF2
> remains on the righ
> axis after either zooming in, or merely plotting multiple contours and
> multiple symmetry lines on the same plot?
> 
> Thanks for any help,
> 
>  -Berrie
> 

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                                    
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:09 MET