Hi Matt. Here's a trick I use frequently to highlight a cut region: Draw a dummy 2D histogram to get the axis ranges, then draw a box for the cut region, and then draw the scatter plot with the "same" option. e.g. { // Run $ROOTSYS/tutorials/hsimple.C first if this file doesn't exist TFile fi("$ROOTSYS/tutorials/hsimple.root", "Read"); // Dummy Histogram for making the boundaries TH2F h2("h2", "", 1, -4, 4, 1, -4, 4); // Box to highlight a region TBox box(0, 0, 4, 4); box.SetFillColor(5); // Draw the histogram, then the box, then the scatter plot h2.Draw(); box.Draw(); gPad->RedrawAxis(); // since the box obscures the ticks ntuple.Draw("px:py", "", "same"); } I was also disappointed to discover that the TPad transparency didn't blend colors. I think it would be great if the transparency options of AttFill did full alpha blending. I would use it, e.g., when drawing one 1D histogram that overlaps another when I don't want to completely obscure the histogram in the background. Stephen On Mon, 4 Dec 2000, Matthew D. Langston wrote: > Hi all, > > I think I am trying to go about setting the transparency and fill color of a > TPad in the wrong way. > > The problem I am trying to solve is to highlight a small section of a > scatterplot. The area of the scatterplot I want to highlight represents a > cut. My first attempt to do this was to put a TPad on top of the > scatterplot and set the TPad's transparency to 4050 (i.e. semi-transparent) > and its fill color to 2 (i.e. red). > > I did this as follows: > > myPad->SetFillStyle( 4050 ); > myPad->SetFillColor( 2 ); > myPad->Modified(); > myPad->Update(); > > The last two commands (i.e. the calls to Modified and Update) don't do > anything from the command line. I have to use the SetFillAttributes context > menu of myPad to set the fill color to red by clicking the Apply button. Is > this right? Isn't there a way to do this from the command line? > > It appears that only one of these settings (i.e. transparency and fill > color) can take affect at the same time, i.e. I can either have a > semi-transparent TPad that has no color (so that I can see the scatterplot > points below it), a solid red TPad (that hides the scatterplot points > beneath it), but not both. > > So, is it possible to set the transparency and the fill color of a TPad > simultaneously? If so, is there a way to do it from the command line? > > Also, is this the right way to highlight a section of a scatterplot? Would > it be better to use something like a TBox or a TWbox instead? > > Thank you for any help. > > Regards, Matt > > -- > Matthew D. Langston > SLD, Stanford Linear Accelerator Center > langston@SLAC.Stanford.EDU >
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:38 MET