UPDATE: I was able to solve it
hist->SetMarkerStyle(2);
hist->Draw(“P”);
Hello All
I am trying to draw a 1D histogram with just points (without any lines or impulse points). From the root manual I see that TH1->Draw("*H") should do that. However, in addition to the points, I still get lines. How do I fix this?
I would like to keep just the points and get rid of the blue lines shown below.
I am trying to draw a solid fit for the fit and a scatter plot for the data.
However, when I draw the histogram with hpx->Draw(“P”), my fit disappears in the plot as shown below:
TCanvas *canoldtof = new TCanvas("canoldtof","canoldtof",600,400);
gStyle->SetOptFit(1011);
gStyle->SetStatStyle(0); // transparent
hpx->GetXaxis()->SetTitle("Timing");
hpx->SetMarkerStyle(7);
hpx->SetTitle(Histtitle);
hpx->Draw("P");
hpx->Fit("gaus","WIQ","P");
FitFunc = hpx->GetFunction("gaus"); // get the function
FitFunc->SetLineColor(kRed); FitFunc->SetLineWidth(1);
Fit_Sigma = FitFunc->GetParameter(2);
TPaveText *fitlabel = new TPaveText(0.15,0.8,0.35,0.9,"NDC");
fitlabel->SetFillColor(42);
char text[400];
sprintf(text,"FWHM=%7.2f",Fit_Sigma*2.3548);
fitlabel->AddText(text);
fitlabel->Draw("same");
canoldtof->Update();
char imagefilename[FILENAME_MAX]; sprintf(imagefilename,"%s/hist.png",CurrentDir);
canoldtof->SaveAs(imagefilename);
More information:
As part of a compiled code I do not get the connecting lines. g++ root-config --cflags --libs test.C -o test
However if I save the histogram in the code (hpx->SaveAs(“hpx.C”);), and then invoke root via command line, I get the points for the histogram and the connecting line for the fit - just as I want.