Re: [ROOT] Drawing on top of a 2-d "CONT" histogram with "same"

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Aug 14 2000 - 19:04:31 MEST


Hi Will,
The option "CONT" in the current versions was based on a 3-D algorithm.
In fact it was using the option "SURF" at theta=0.
This, as you found, prevented superimposing other contours on the existing
contours.

I have now upgraded the contours options to solve this problem.
At the same time, I have implemented a new facility requested by many users,
the possibility to access the contour points. This is now available
in our CVS repository. The modifications notes say:

- New options to draw contours for 2-d histograms.
  The contour option "CONT" is now a pure 2-D option. It is not based
  on the surface/lego algorithms. 
  This option computes now a set of points stored in a list of TGraph objects.
  The points in the TGraph are sorted, such that one contour can be drawn
  with one fill area. In addition, when the option "List" is specified,
  the list of generated TGraph objects is stored in a TObjArray with the
  name "contours". This TObjArray is accessible via gROOT->GetListOfSpecials().
  When the option "CONT" is used, one can superimpose new contours on top
  using the options "CONT1", "CONT2" or "CONT3".
  The previous algorithm used by the option "CONT" is still available
  as option "CONT4".
  For example, the following call
     h2->Draw("contzlist");
  produces:
    - a picture with surface colors to delimitate each contour
    - the color palette.
    - a list of the boundary points for each countour.
  The points used to draw the contours are saved in the TGraph format
  and are accessible in the following way:
  TObjArray *contours = 
           gROOT->GetListOfSpecials()->FindObject("contours")
  Int_t ncontours = contours->GetSize();
  TList *list = (TList*)contours->At(i); //where i is a contour number   
  list contains a list of TGraph objects. For one given contour, more than 
  one disjoint polyline may be generated. The number of TGraphs per 
  countour is given by list->GetSize(). 
  Here we show only the case to access the first graph in the list.
    TGraph *gr1 = (TGraph*)list->First();


Rene Brun



Will Robinson wrote:
> 
> I would like to be able to draw a 2-d histogram with the "CONT" drawing
> option, and then draw 2 2-d histograms on top of that one (each of these
> new histograms is being drawn with the "CONT2SAME" option...they are
> basically lines meant to highlight regions in the lowest "CONT" filled-in
> histogram).
> 
> Here's the problem:
> When I draw the histograms as specified, only the lowest one
> ("CONT") shows up.  However, when I change the drawing option of the
> lowest histogram to "CONT1", all 3 histograms show up.  This is nice, but
> I would really like to have the "CONT" histogram in all of its
> filled-color glory at the bottom of the picture.
> 
> Is there a reason for this behavior, and more importantly, a way around
> it?
> 
> Thanks,
> Will Robinson
> wsr23@stanford.edu



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET