Histogram from TFile not respecting gROOT->UseCurrentStyle

I have some TFiles with some TH1 in them. When I get them from the file and draw them, they are drawn with crosses instead of the usual style. This happens even if I use UseCurrentStyle() or ForceStyle(). Newly-created histograms have the usual style. How can I draw the TH1 retrieved from the file in the same manner?

I’ve attached one of my ROOT files and a small script that reproduces the two ways of drawing, along with the two PDFs produced on my system.

show.py (433 Bytes) show.root (33.8 KB) show0.pdf (14.6 KB) show1.pdf (13.5 KB)

You can run the script by doing “python -i show.py”.

ROOT Version: 6.18/00
Platform: Ubuntu Linux, PyROOT on Python 3.6.8

If I do:

root [0] gStyle->SetMarkerStyle(20);
root [1] gROOT->ForceStyle()
root [2] TFile *_file0 = TFile::Open("show.root")
(TFile *) 0x7fa566e0c480
root [3] h5->Draw()

The the new marker style is applied to h5.

Yes, but h5 still doesn’t look like a new histogram created like:

TH1D hnew("hnew","hnew",10,0,10);

How can I get h5 from the file to look like a regular plain ROOT histogram, with bars and stuff instead of markers?

You need to plot it with option “hist”

That’s what I was missing. I didn’t realize the “h5” in the file had error bars, I thought it was drawing differently due to a style setting. Thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.