Hi, I run the following macro to plot a constant value using the TGraph Draw() method. The horizontal axis has range 0 to 999, with a total of 1000 bins. I set the constant value on the vertical axis to be 3 in this example. By using the fill option of the Draw() method, I expect to see a rectangle of height 3 and length 1000, completely filled in with the fill color of my choice. Instead I see erratic behavior with the 'fill' option UNLESS I explicitly set to zero the bins 203, 406, 609, 812. Has anyone else seen strange behavior with the fill option when making a plot with many bins? My current work around is, unfortunately, to avoid using the fill option. thanks, Tony int mytest() { Float_t x_values[2016]; Float_t y_values[2016]; Int_t i; Float_t num_points; gROOT->Reset(); gStyle->SetCanvasColor(0); gStyle->SetPadGridX(1); gStyle->SetPadGridY(1); num_points = 1000; for (i = 0; i<num_points; i++){ x_values[i] = i; } for (i=0; i<num_points; i++){ y_values[i] = 3; } // Reset end points to zero (to avoid unwanted display features of // 'fill' option of Draw() ). y_values[0] = 0; y_values[num_points-1] = 0; // For some reason I need the next four lines. y_values[203] = 0; // Erratic fill behavior if commented out y_values[406] = 0; // Erratic fill behavior if commented out y_values[609] = 0; // Erratic fill behavior if commented out y_values[812] = 0; // Erratic fill behavior if commented out TCanvas *canvas = new TCanvas("canvas","my plot",10,10,500,600); TGraph *Graph = new TGraph(num_points, x_values, y_values); Graph->SetFillColor(6); Graph->SetMaximum(10); Graph->Draw("ALF"); // draw with fill option return 0; }
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:34 MET