I’m trying to make a figure but fails… I’ve attached a script and the output of it. The problem is of course that I can’t control the number of ticks and/or which labels are written next to the axis. In my example I would like something like one or two labels for y, but not 0 nor maxvalue as this interferes with the histogram above or below. For x I would like labels such as 595 and 615, but thats is!!!
Trying with SetNDivision got me nowhere…
HelpSpectra.C (3.21 KB)
Can you provide a running macro ? I get:
Error: illegal pointer to class object h 0x0 139 HelpSpectra.C:58:
*** Interpreter error recovered ***
strange, it works for me with this configuration
csnwifi148:Downloads joa$ root-config --version
csnwifi148:Downloads joa$ uname -a
Darwin csnwifi148.in2p3.fr 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386
csnwifi148:Downloads joa$ g++ --version
i686-apple-darwin10-g+±4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright © 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
also when trying the script downloaded from this forum, in case I had messed up uploading it…
Anyway, here is the same script, but in named version that can be compiled, works like a charm here
csnwifi148:Downloads joa$ root -l
root  .L HelpSpectra.C++
Info in TUnixSystem::ACLiC: creating shared library /Users/joa/Downloads/./HelpSpectra_C.so
root  HelpSpectra()
Info in TCanvas::Print: file help.png has been created
so, no real idea why the script didn’t work for you…
HelpSpectra.C (3.41 KB)
Ok, your new file is working for me .
May be the download went wrong yesterday.
I will modify it and send it back
thanks for the help, although it is a bit fragile. I changed the script so that it fills the histogram with a random number of entries between 60 and 6000 (as opposed to the 600 before). And then the y axis again becomes somewhat difficult to control. Is there a general way to do what I want? Can’t I tell an axis I want a label every 20 or something like that?
HelpSpectra.C (3.44 KB)
set the number of division to 204 at the beginning of the macro