I have a probelm plotting 2 variables from a ttree in histogram… which I already did and it is simple, so I don’t understand why it doesn’t wors… probably is something stupid…
following the code, and the root file that I use in input is the same as here https://root-forum.cern.ch/t/histogram-bins-shifted/25561:
the problem is that the canvas that I save is ok, but fot the histogram I received an error message:
AttributeError: ‘PyROOT_NoneType’ object has no attribute ‘SaveAs’
yes you are right, this was my mistake to copy the macro, but in the code is corret: histo_tot…
what it is also strange is that if I plot only 1 variable, doing for example:
imported_tree.Draw(“z_step>>histo_tot”,"","")
in this way it’s works, but it’s not what I want… any idea?
Be careful that you are trying to fill a 1D histogram with two variables. I do not have your data file so I simulated your macro with the ntuple sitting in hsimple.root generated by $ROOTSYS/tutorials/hsimple.c.
$ root -n boog3.C
-----------------------------------------------------------------
| Welcome to ROOT 6.11/01 http://root.cern.ch |
| (c) 1995-2017, The ROOT Team |
| Built for macosx64 |
| From heads/master@v6-09-02-2009-gdcbfa1d, Aug 11 2017, 10:11:09 |
| Try '.help', '.demo', '.license', '.credits', '.quit'/'.q' |
-----------------------------------------------------------------
root [0]
Processing boog3.C...
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
Info in <TH1F::SaveAs>: ROOT file prova.root has been created
root [1]