Histogram plotting

Hello All,

I have a problem: How can I turn off the grid on a TH2f plot (global?) ?
gPad->SetGrid(1,0); not work

How can I globalize this (I have multiple pads):
h->GetXaxis()->SetNdivisions(5);
h->GetYaxis()->SetNdivisions(5);
h->GetZaxis()->SetNdivisions(5);

( if I open the “DrawPanel”(right click on the histo) on a canvas the refresh of the graph will be terrible slow (eg. rotation)… Does anybody have the same problem? )

Thank You!

Tamas

[quote]I have a problem: How can I turn off the grid on a TH2f plot (global?) ?
gPad->SetGrid(1,0); not work [/quote]

By default there is no grid. So , do not call this function or call
gPad->SetGrid(0,0);

[quote]How can I globalize this (I have multiple pads):
h->GetXaxis()->SetNdivisions(5);
h->GetYaxis()->SetNdivisions(5);
h->GetZaxis()->SetNdivisions(5); [/quote]

Global options are set via TStyle. In your case, do:
gStyle->SetNdivisions(5,“X”);
gStyle->SetNdivisions(5,“Y”)

Please send a concrete example and more explanations.
Which version/OS?

Rene

Thank You for you answer.

The problem with “DrawPanel” is on root 4.03/02 compiled from source with cernlib (suse 9.2 gcc version 3.3.4).
I have one canvas with two pads on it. Each has a 3d histogram. If I open the DRawPanel by right clicking on one of the histograms then the rotation of the histograms becomes very slow. There is no error message so maybe it is ok, but why does the speed change? If I close the Drawpanel the speed is still slow. BTW on MS Windows this rotation speed is very slow w/ or w/o the DrawPanel.

What are the Options labeled as Front and Back on a 3d histogram on DRawPane? How can I turn them off by default?

Sincerely,

Tamas

I see the problem when rotating a TH3 and the Drawpanel is active.
We will fix this problem.
However the rotation speed should be OK whitout the Drawpanel

Rene

Hello again,

the code:

gStyle->SetNdivisions(5,“X”);
gStyle->SetNdivisions(5,“Y”);

does not work in my case (I’ve included TStyle.h) I’ve tried before
TCanvas *MyC = new TCanvas( “MyC”,“MYCANVAS”,800,600);
and after but no luck. I’ve even tried after an before the
TApplication theApp(“App”, &argc, argv);
still no luck.

and also how can I turn off the Front and Back “grid” (not using DRAWPANEL) on TH3 graph from a program.

Thanks,

Tamas

Nevermind, it’s working…

Something else… if I play with the “front box” and the “back box” buttons on the “DrawPanel” (TH3 histo) for couple of times I got the
following error:

[color=red]*** Break *** segmentation violation
Generating stack trace…
0x4019822c in TString::Replace(int, int, char const*, int) at base/src/TString.cxx:633 from /usr/local/root/lib/libCore.so
0x4019b768 in TString::Remove(int, int) at include/TString.h:509 from /usr/local/root/lib/libCore.so
0x42506045 in TH2Editor::DoAddBB() at ged/src/TH2Editor.cxx:1382 from /usr/local/root/lib/libGed.so
0x42535726 in from /usr/local/root/lib/libGed.so
0x40867a9b in G__CallFunc::Exec(void*) at cint/src/CallFunc.cxx:388 from /usr/local/root/lib/libCint.so
0x40180488 in TQSlot::ExecuteMethod(void*, long) at base/src/TQConnection.cxx:227 from /usr/local/root/lib/libCore.so
0x4017fec7 in TQConnection::ExecuteMethod(long) at base/src/TQConnection.cxx:509 from /usr/local/root/lib/libCore.so
0x4018335b in TQObject::Emit(char const*, long) at base/src/TQObject.cxx:779 from /usr/local/root/lib/libCore.so
0x4040da4c in TQObject::Emit(char const*, bool) + 0x30 from /usr/local/root/lib/libCore.so
0x414370ba in TGButton::Toggled(bool) at include/TGButton.h:125 from /usr/local/root/lib/libGui.so
0x41432e37 in TGCheckButton::EmitSignals(bool) at gui/src/TGButton.cxx:808 from /usr/local/root/lib/libGui.so
0x41432ff3 in TGCheckButton::HandleButton(Event_t*) at gui/src/TGButton.cxx:856 from /usr/local/root/lib/libGui.so
0x41472f4e in TGFrame::HandleEvent(Event_t*) at gui/src/TGFrame.cxx:455 from /usr/local/root/lib/libGui.so
0x41446c4d in TGClient::HandleEvent(Event_t*) at gui/src/TGClient.cxx:741 from /usr/local/root/lib/libGui.so
0x4144674c in TGClient::ProcessOneEvent() at gui/src/TGClient.cxx:582 from /usr/local/root/lib/libGui.so
0x414468b6 in TGClient::HandleInput() at gui/src/TGClient.cxx:629 from /usr/local/root/lib/libGui.so
0x41444881 in TGInputHandler::Notify() at gui/src/TGClient.cxx:77 from /usr/local/root/lib/libGui.so
0x402a4301 in TUnixSystem::DispatchOneEvent(bool) at unix/src/TUnixSystem.cxx:682 from /usr/local/root/lib/libCore.so
0x401a635a in TSystem::InnerLoop() at base/src/TSystem.cxx:316 from /usr/local/root/lib/libCore.so
0x401a62e8 in TSystem::Run() at base/src/TSystem.cxx:284 from /usr/local/root/lib/libCore.so
0x4012264c in TApplication::Run(bool) at base/src/TApplication.cxx:830 from /usr/local/root/lib/libCore.so
[/color]
Tamas

Please read the conditions to report a problem and traceback at
root.cern.ch/root/roottalk/RoottalkRules.html

Rene

Hello Rene,

I’ve attacehed a sample program.
I’m using Borland’s CbuilderX so I don’t have makefile.
(but I guess it is easy to create one)

I’ve checked it on Ms Windows( root: last release) also, same problem.

Linux : Suse 9.2, gcc version 3.3.4, linux 2.6.8-24.11-smp
root CVS HEAD Version 4.03/03 1 March 2005
root-conf: QTDIR=/usr/lib/qt3 linux --build=debug --enable-qt --enable-table

Sincerely,

Tamas

bt output:
/////
tamas@linux:~/cbproject/test2/linux/root_build> gdb test2
GNU gdb 6.2.1
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “i586-suse-linux”…Using host libthread_db library “/lib/tls/libthread_db.so.1”.

(gdb) run
Starting program: /home/tamas/cbproject/test2/linux/root_build/test2
[Thread debugging using libthread_db enabled]
[New Thread 1106338944 (LWP 9833)]
Detaching after fork from child process 9837.
Warning in TH1::Build: Replacing existing histogram: some data (Potential memory leak).

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1106338944 (LWP 9833)]
0x41d130c9 in memmove () from /lib/tls/libc.so.6
(gdb) bt
#0 0x41d130c9 in memmove () from /lib/tls/libc.so.6
#1 0x4019822c in TString::Replace (this=0xbfffeb20, pos=-154576836, n1=2, cs=0x0, n2=0)
at TString.cxx:633
#2 0x4019b768 in TString::Remove (this=0xbfffeb20, pos=-154576836, n=2) at TString.h:509
#3 0x42508045 in TH2Editor::DoAddBB (this=0x91e3338) at TH2Editor.cxx:1382
#4 0x42537726 in G__G__Ged_337_4_2 () from /usr/local/root/lib/libGed.so
#5 0x40867a9b in G__CallFunc::Exec (this=0x93038e8, pobject=0x91e3338)
at CallFunc.cxx:388
#6 0x40180488 in TQSlot::ExecuteMethod (this=0x93038c0, object=0x91e3338, param=1)
at TQConnection.cxx:227
#7 0x4017fec7 in TQConnection::ExecuteMethod (this=0x93037e0, param=1)
at TQConnection.cxx:509
#8 0x4018335b in TQObject::Emit (this=0x9219f38,
signal_name=0x416ce758 “Toggled(Bool_t)”, param=1) at TQObject.cxx:779
#9 0x4040da4c in TQObject::Emit () from /usr/local/root/lib/libCore.so
#10 0x414370ba in TGButton::Toggled (this=0x9219f10, on=true) at TGButton.h:125
#11 0x41432e37 in TGCheckButton::EmitSignals (this=0x9219f10) at TGButton.cxx:808
#12 0x41432ff3 in TGCheckButton::HandleButton (this=0x9219f10, event=0xbfffede0)
at TGButton.cxx:856
#13 0x41472f4e in TGFrame::HandleEvent (this=0x9219f10, event=0xbfffede0)
at TGFrame.cxx:455
#14 0x41446c4d in TGClient::HandleEvent (this=0x8c891e0, event=0xbfffede0)
at TGClient.cxx:741
#15 0x4144674c in TGClient::ProcessOneEvent (this=0x8c891e0) at TGClient.cxx:582
#16 0x414468b6 in TGClient::HandleInput (this=0x8c891e0) at TGClient.cxx:629
—Type to continue, or q to quit—
#17 0x41444881 in TGInputHandler::Notify (this=0x8c99f30) at TGClient.cxx:77
#18 0x402a4301 in TUnixSystem::DispatchOneEvent (this=0x8b81c40, pendingOnly=false)
at TUnixSystem.cxx:682
#19 0x401a635a in TSystem::InnerLoop (this=0x8b81c40) at TSystem.cxx:316
#20 0x401a62e8 in TSystem::Run (this=0x8b81c40) at TSystem.cxx:284
#21 0x4012264c in TApplication::Run (this=0xbffff090, retrn=false) at TApplication.cxx:830
#22 0x08049bc9 in main (argc=1, argv=0xbffff164) at test2.cpp:71
(gdb)
test2.cpp (4.16 KB)

Hi,
I’ve found using my code with the new CVS ROOT, that
I get Segfault message, but the application is not crashing.
Somehow good news but hope there isn’t a hidden (flying pointer) error.

Thanks,

TRS

PS: Thanks for the rotation fix