TH1F *hist = new TH1F("hist", "Basic Histogram", 10, 0, 10); hist->Fill(2.2); hist->Fill(3.7); hist->Fill(5.1); hist->Draw();
TH1F *hist = new TH1F("hist", "Histogram with Labels", 10, 0, 10); hist->GetXaxis()->SetTitle("X Axis Label"); hist->GetYaxis()->SetTitle("Y Axis Label"); hist->Fill(2.2); hist->Fill(3.7); hist->Fill(5.1); hist->Draw();
TH1F *hist = new TH1F("hist", "Histogram with Styling", 10, 0, 10); hist->SetLineColor(kRed); hist->SetMarkerStyle(22); hist->Fill(2.2); hist->Fill(3.7); hist->Fill(5.1); hist->Draw("E");This example creates a simple histogram with a red line and circular markers. It fills the histogram with three sample values and then draws the histogram with the "E" option, which shows both the markers and line. These examples were created using the ROOT framework, which is a package library for scientific computing with C++.