Drawstyle not saved if histogram saved in rootfile?

11 views
Skip to first unread message

André Günther

unread,
Aug 30, 2017, 5:30:26 AM8/30/17
to rootpy users
Hi all! 

I would like to save histograms in a root file with the drawstyle set to 'hist'. However, the drawstyle seems to get lost when I save the histogram. 
Example:
 
from rootpy.plotting import Hist
from rootpy.interactive import wait
from rootpy.io import root_open

hist = Hist(100, -4, 4, name='gaus', title='gaus', drawstyle='hist')
hist.FillRandom('gaus', 10000)
hist.Draw('h') # 'h' is not necessary because drawstyle is already 'hist'
wait()
output = root_open('output.root', 'recreate')
hist.Write()


Is there a way to save the histogram with the 'hist' style such that when I open the file in the TBrowser and display the histogram it still shows up as 'hist'?

Cheers,
Andre

Noel Dawe

unread,
Aug 31, 2017, 9:19:16 PM8/31/17
to rootpy...@googlegroups.com
Hi Andre,

Presently no. Transient rootpy decorations are not saved along with objects in files. This would be possible by saving a pickled dictionary in a TObjString along with every object but still TBrowser wouldn't be aware of that.

Best,
Noel

--
You received this message because you are subscribed to the Google Groups "rootpy users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rootpy-users+unsubscribe@googlegroups.com.
To post to this group, send email to rootpy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rootpy-users/2fb68522-31a7-4b6b-9895-ec0dea0a6ecc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages