Problem with png of divided canvas in 5-34/19 on Mac

Hi

When I tried to save png of the divided canvas in ROOT v5.34/19 on Mac OS X 10.9.4 Mavericks, ROOT 5.34/19 saved the first pad only. There is not such problem with Scientific Linux 6.5. Find below macro canvas2x2.C which reproduces the problem. I also attached the png file.

Andriy

{
//-- Thu Jul 24 12:41:15 PDT 2014;
f = new TF1(“f”,“sin(x)/x”, -20,20);
TH1F* h = new TH1F(“h”,“h”, 100,-3,3);
h->FillRandom(“gaus”);
c = new TCanvas;;
c->Divide(2,2);
c->cd(1);
f->Draw();
c->cd(2);
h->Draw();
Double_t x[5] = {0,1,2,3,4};
Double_t y[5] = {0,1,4,9,16};
g = new TGraph(5,x,y);
c->cd(3);
g->Draw(“a*”);
g->Fit(“pol2”);
pol2 = g->GetFunction(“pol2”);
c->cd(4);
pol2->Draw();
c->cd();
gPad->SaveAs(“canvas2x2.png”);
}

It seems like the “gPad” was not correctly pointing to “c”.
Right before “gPad->SaveAs(…);” try to add:
c->Modified(); c->Update();
If it doesn’t help. try to replace “gPad->SaveAs(…);” with “c->SaveAs(…);”.

Nothing helps. I believe this is a bug. NB: the version v5.34/18 works fine.

Andriy

I do not have problem on mac with :

  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.34/19       9 July 2014   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.34/19 (heads/v5-34-00-patches@v5-34-19-21-gf2b4449, Jul 17 2014, 13:46:05 on macosx64)

I confirm that this problem still exists in the new ROOT Version 5.34/20 12 August 2014.
FYI, there is no that problem in 5.34/18.

Best,
Andriy

Can it be that something in your environment points to some old ROOT version (so that your new ROOT loads some old libraries, references old ROOT’s etc subdirectory, …)?
Check your “${ROOTSYS}”, “${PATH}”, “${LD_LIBRARY_PATH}”, “${DYLD_LIBRARY_PATH}”, …
Check your “${HOME}/.rootrc”, “./.rootrc”, “./rootlogon.C”, …

I started to suspect that there’s something screwy in your setup as the picture that you show contains the [XY]-grid lines, but when I run your macro I get no grid at all (so there’s something in your setup that changes the default behavior). Also your thickness of all lines is much higher than the default, I believe.

I carried out a clean experiment: rebuild version 18 like I did with v5.34/19 and v5.34/20:

downloaded v5.34/18 and untared it
./configure --all
make

and ran the macro.

Result: version 18 create png for the whole canvas with four pads while versions 19 and 20 create just the first pad.
The grid lines, etc. come from my system rootlogon.C. I did
root -n canvas2x2.C
with the same result: correct png for version 18 and the first pad only for version 20.

Best,
Andriy

P.S. I keep all root setups in the directory /srv/opt/root and link current version to root, so all versions are equal wrt environment:

root$ pwd
/srv/opt/root
root$ ls -l
total 24
lrwxr-xr-x 1 zatserkl staff 13 Aug 16 00:23 root -> root_v5.34.20
drwxr-xr-x 39 zatserkl staff 1598 Aug 16 00:03 root_v5.34.18
drwxr-xr-x@ 39 zatserkl staff 1632 Jul 19 13:38 root_v5.34.19
drwxr-xr-x@ 39 zatserkl staff 1598 Aug 15 11:28 root_v5.34.20

How do you switch between different ROOT versions?
Do you have any ROOT specific entries in your “${HOME}/.bashrc” (assuming that bash is your login shell)?

To change root setup I just change link like

root$ rm root ; ln -s root_v5.34.18 root

This is a ROOT-relayted content of my .bash_profile:

export ROOTSYS=/srv/opt/root/root
export LD_LIBRARY_PATH=$ROOTSYS/lib
export PATH=${ROOTSYS}/bin:${PATH}

Try the following procedure (in case anything goes wrong you’ll have additional “configure.out.txt” and “make.out.txt” files to look into): [code]#

make sure we have a clean source code

cd /srv/opt/root
rm -f root
rm -rf root_v5.34.20
wget ftp://root.cern.ch/root/root_v5.34.20.source.tar.gz
tar -zxf root_v5.34.20.source.tar.gz
mv root root_v5.34.20

make sure really NOTHING in the environment points to ANY old ROOT version

cd /srv/opt/root
rm -f root
unset ROOTSYS
if [ -e “${HOME}/.rootrc” ] ; then mv -f ${HOME}/.rootrc ${HOME}/.rootrc.old ; fi

build new ROOT

cd /srv/opt/root
cd root_v5.34.20
./configure --enable-soversion --all > configure.out.txt 2>&1
make > make.out.txt 2>&1[/code] and then open a new xterminal and try: [code]cd /srv/opt/root/root_v5.34.20
source bin/thisroot.sh

cd /Where/You/Keep/The/canvas2x2/Test/Macro
root -n canvas2x2.C[/code]

Hi Wile,

I everything what you suggested for the new version (unset, clean install, everything is default, etc.), but the result is the same: the ROOT saves picture of the first pad only.
The last version (after the same install procedure) which saves the whole canvas with pads is root_v5.34.18.

I’d like to remind you that I use Mac OS X 10.9.4 on the case-sensitive file system. I’m using MacPorts for additional software.

Best,
Andriy


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 5.34/21 9 September 2014 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

ROOT 5.34/21 (v5-34-21@v5-34-21, Sep 09 2014, 15:29:00 on macosx64)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010

I am back from holidays now… I will check …

[quote=“zatserkl”]Hi Wile,

I everything what you suggested for the new version (unset, clean install, everything is default, etc.), but the result is the same: the ROOT saves picture of the first pad only.
The last version (after the same install procedure) which saves the whole canvas with pads is root_v5.34.18.

I’d like to remind you that I use Mac OS X 10.9.4 on the case-sensitive file system. I’m using MacPorts for additional software.

Best,
Andriy


  •                                     *
    
  •    W E L C O M E  to  R O O T       *
    
  •                                     *
    
  • Version 5.34/21 9 September 2014 *
  •                                     *
    
  • You are welcome to visit our Web site *
  •      [root.cern.ch](http://root.cern.ch)            *
    
  •                                     *
    

ROOT 5.34/21 (v5-34-21@v5-34-21, Sep 09 2014, 15:29:00 on macosx64)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010[/quote]

The problem is fixed in both 5.34 and 6.x