Grid

hi
very stupid question: How is it possible to change the amount of grid lines? I can’t find anything in the user’s guid and google gives also no advice.
I set the grid with:

SetGridx()

and I want more lines…
Thanks for the help
regards
florian

Change the number of primary divisions for the axis
axis->SetNdivisions(…) //see doc

Rene

As Rene said, the grid is drawn on the primary divisions. Some times ago a ROOT user asked me how to draw a grid on intermediate divisions also. I wrote a macro doing that for him. In case you are interested here it is:

{
   TCanvas *c1 = new TCanvas("c1","c1",10,10,1000,500);

   // Draw an histogram

   TH2C *h100 = new TH2C("h100","h100",32,0.,32.,64,0.,64.);
   h100->SetStats(0);
   h100->GetXaxis()->SetNdivisions(32);
   h100->GetYaxis()->SetNdivisions(16);
   h100->Draw();

   // Draw grid

   TPad *grid = new TPad("grid","",0,0,1,1);
   grid->Draw();
   grid->cd();
   grid->SetGrid();
   grid->SetFillStyle(4000);

   TH2 *hgrid = new TH2C("hgrid","",32,0.,32.,64,0.,64.);
   hgrid->SetStats(0);
   hgrid->Draw();
   hgrid->GetXaxis()->SetNdivisions(32);
   hgrid->GetYaxis()->SetNdivisions(64);
   hgrid->GetYaxis()->SetLabelOffset(999.);
   hgrid->GetXaxis()->SetLabelOffset(999.);

}

thanks a lot…