Change TH3F background colors

Hi everybody,

I have 2 questions about TH3F:

  1. I would like to know if there is a way to modify the background color of a TH3F “box” (i.e. in version 5.22.00a it was gray, now in version 5.22.00b it is white).
  2. Is it possible to add dotted lines at the 2 back walls of the cube (= coordinate system box), correspondind to the scale values, in easy words I would like to get the same box like TGraph default.

Thank you very much for all help,
Cheers

When you draw a TH3 with no option or with the option BOX the box around the data is transparent and the grid not drawn. When you draw it with the option ISO then it is like a LEGO of SURF with 2D histograms. In other words the techniques to draw the axis are different in both cases. To be done.

Hi,
Thank you for your reply but I think that I was not clear.

  1. I want only to modify the background color of my TH3F coordinate box, I’m not using histograms, but only points TPolyMarkers3D, so I’m using TH3F to generate the axis.
    I want to use the grey color instead of white, see picture 1, but I don’t find the correct sintax to do it.

  2. If is possible I would like to create some dotted lines at the 2 back walls of this coordinate cube, see picture 2.

Thank you another time for your help.
Cheers




void gr3d ( Double_t zmin=-10., Double_t zmax=+10. )
{
   Int_t nPoints=5 ;
   Double_t x1[] = {1., 3., 5., 7., 9.} ; Double_t x2[] = {1., 3., 5., 7., 9.} ;   Double_t y1[] = {0., 0., 0., 0., 0.} ; Double_t y2[] = {3., 3., 3., 3., 3.} ;   Double_t z1[] = {0., 3.,-2., 3., 4.} ; Double_t z2[] = {3.,-1., 2., 2., 0.} ;
   TPolyLine3D *line3D_1 = new TPolyLine3D (nPoints,x1,y1,z1) ;
   line3D_1->SetLineColor(kRed ) ;
   TPolyLine3D *line3D_2 = new TPolyLine3D (nPoints,x2,y2,z2) ;
   line3D_2->SetLineColor(kBlue) ;

   Double_t xmin=0., xmax=10., resolution=0.5 ;
   Int_t nBins = Int_t((xmax-xmin)/resolution) ;

   TH2F* histo = new TH2F("histo","", nBins,xmin,xmax, 1,y1[0],y2[0]) ;
   histo->SetStats(kFALSE) ;
   histo->SetMinimum(zmin) ; histo->SetMaximum(zmax) ;
   histo->SetXTitle("#lambda  [nm]"    ) ;
   histo->GetXaxis()->CenterTitle() ;
   histo->SetYTitle("time  [min]"      ) ;
   histo->GetYaxis()->CenterTitle() ;
   histo->SetZTitle("intensity  [a.u.]") ;
   histo->GetZaxis()->CenterTitle() ;

   TCanvas *canvas = new TCanvas("canvas","canvas",0,0,1000,618) ;
   canvas->SetFrameFillColor(30);
   canvas->SetTheta(23.) ; canvas->SetPhi(-23.) ;
   gPad->SetLeftMargin(0.18) ;
   gPad->SetRightMargin(0.10) ;
   gPad->SetTopMargin(0.20) ;
   gPad->SetBottomMargin(0.20) ;
   histo->Draw("lego0,fb") ;
   line3D_1->Draw() ;
   line3D_2->Draw() ;
}

Hi,
Perfect! Thank you very much!
Cheers,