Removing time stamp on root plots

Hello experts,

I was wondering if there is a way to get rid of the time stamp that shows up by default when generating a root plot? Please, see the attached example plot below. I am referring to the “Mon Nov 8 11:54:25 2021” portion of the plot, and if there is a command I can include in my plotting macro that will turn off the feature of showing a time stamp. Thank you very much!

If you want to remove the “time stamp”, you need to exclude the commands that draw it from your plotting macro.

Hello @Wile_E_Coyote,

Thank you very much for the quick reply!

When I look at my plotting macro, which is a modified version of a template I found online, I do not see an explicit place where the plotting macro executes a command to show the timestamp. Any thoughts on this? Please, see my attached plotting macro below.

void scatterPlots_tofQA()
{
        TString inputFileName = TString("./test_TofQAOutFile_16127006.root");
        TFile* inputFile      = new TFile(inputFileName.Data());

        TIter keyList(inputFile->GetListOfKeys());
        TKey *key;
        TCanvas c1;
        c1.Print("scatterPlots_tofQA.pdf[");
        while ((key = (TKey*)keyList())) {
                TClass *cl = gROOT->GetClass(key->GetClassName());
                if (!cl->InheritsFrom("TH2")) continue;
                TH2 *h = (TH2*)key->ReadObj();
                string histoName = h->GetName();
                cout << h->GetName() << endl;
                gStyle->SetOptStat(111111);
                gStyle->SetStatY(0.99);
                gStyle->SetStatX(0.9);
                gStyle->SetStatW(0.2);
                gStyle->SetStatH(0.12);
                h->Draw("colz");
                c1.Print("scatterPlots_tofQA.pdf");
        }
        c1.Print("scatterPlots_tofQA.pdf]");
}

For test purposes, add there (maybe that’s where the “time stamp” is hiding):

std::cout << h->GetXaxis()->GetTitle() << std::endl;
std::cout << h->GetYaxis()->GetTitle() << std::endl;

I added those test statements and here is the output. It doesn’t seem like anything is stored in the axis titles.

root4star -l -b -q scatterPlots_tofQA.C
root4star [0] 
Processing scatterPlots_tofQA.C...
Info in <TCanvas::Print>: pdf file scatterPlots_tofQA.pdf has been created
h2_JP2_numGTrkBTofHitsVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_numGTrkBTofHitsVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_numPTrkBTofHitsVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_numPTrkBTofHitsVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_jetPtVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_jetPtVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_jetEtaVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_jetEtaVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_jetPhiVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_jetPhiVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_jetRtVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_jetRtVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_jetTrackMultVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_jetTrackMultVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_JP2_jetTowerMultVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
h2_BBCMB_jetTowerMultVsNumBTofHits


Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf
Info in <TCanvas::Print>: Current canvas added to pdf file scatterPlots_tofQA.pdf

This is the end of ROOT -- Goodbye

Try the standard “root -n” instead of “root4star”.
Try also “root4star -n ...”.

I tried both root -n and root4star -n and they both lead to the same output attached below. However, now the histogram title is a off and I also lost the grid. But, the time stamp did go away.

Search for “rootlogon.C” and “.rootrc” files (in your “${HOME}” and the current working directory).

Thank you very much! I will give those a shot and see how it goes!

The solution ended up being that I added gStyle->SetOptDate(0) right before gStyle->SetOptStat(111111) in my plotting macro, and the timestamp went away. :slight_smile: Below is the output.

Just for future reference … where was this “gStyle->SetOptDate(some_non_zero_value)” coming from?

I am honestly not sure where it is coming from. I am also not really sure where to look besides my macro.