TH3F saved looks quite different as on screen

Hello,

I have TH3 histogram plotted as:

gStyle->SetCanvasPreferGL(1);
energyHistModified->Draw(“glcolz”);

and it looks on my monitor like the Fig 1 attached.

However, after saved as an EPS file, the saved file looks like the attached Fig 2 attached.

And if I save the histogram as a GIF file, the saved file looks like Fig 3…

I would be very grateful if you could please tell me how I can save the TH3 histogram in order to look like it was produced by ROOT.

Thank you,

Cristian






The GL option is preferably used for screen display. But the png output should be as good as screen (I just tried).

Thank you. For PNG I get some errors, probably related to my applications installation on MacOSX:

root [2] libpng warning: Application built with libpng-1.4.11 but running with 1.5.11
Warning in TASImage::GetMask: No image
libpng warning: Application built with libpng-1.4.11 but running with 1.5.11
Warning in TASImage::GetMask: No image
libpng warning: Application built with libpng-1.4.11 but running with 1.5.11
Info in TCanvas::Print: file /Users/cristian/ISIS/HeatGenerated/HeatGenerated3/temp_Ni.png has been created
Cristians-iMac:HeatGenerated3 cristian$ ls -l temp_Ni.png
-rw-r–r-- 1 cristian staff 0 30 Sep 14:54 temp_Ni.png

I will try it on my linux PC.

Thank you,

Cristian

I am on Mac too. Can you post a small macro reproducing the issue ?

on Linux it worked. I will post soon the macro file and the root file to reproduce the issue.

Thank you,

Cristian

Hello again,

I have attached the script and the root file. Please let me know if you can save and view the cut view as png and if the image is preserved.

Probably something happened to my local libpng library on my Mac.

Also I have tried to use the transfer_function to play with the transparency. If you do know any values I should use to improve the image quality, I would be very grateful for any suggestions. So far, the best image I got was with:

Double_t transfer_function(const Double_t *x, const Double_t * /param/)
{
if (*x < 0.05e-15)
return 0.03;
if (*x > 0.05e-15 && *x < 0.05e-12)
return 0.05;
if (*x > 0.05e-12 && *x < 0.15e-12)
return 0.1;
if (*x > 0.15e-12 && *x < 0.23e-12)
return 0.3;
if (*x > 0.23e-12 && *x < 0.26e-12)
return 0.8;
return 0.8;
}

and in the script, AFTER

energyHistModified->Scale(1./(150.*5.e7));

I used

//Transfer function.
TList * lf = energyHistModified->GetListOfFunctions();
if(lf)
{
    TF1 * tf = new TF1("TransferFunction", transfer_function);
    lf->Add(tf);
}

Best regards,

Cristian

The root file is too big to attach. I can attach only the script…
png_issue.C (3.41 KB)

Ok … but that’s not really helpful:

root [0] 
Processing png_issue.C...
Error in <TFile::TFile>: file rel_energy.root does not exist
Could not find energy_hist or type is not TH3 derived
root [1] 

May be build a fake macro reproducing the problem ?

The same macro I sent before, but here is a much smaller root file…

The transfer_function will not work well, but the png error I still get it, so you can test the png image to see how it works.

Cristian
rel_energy.root (213 KB)

On my mac I get the same picture than on the screen.


Then it must something wrong with my png library. I never saved as png in the past (only gif, eps and root), so it’s the first time I’ve noticed this. On my linux PC it works fine.

The error is:
Application built with libpng-1.4.11 but running with 1.5.11
so not a ROOT problem. Maybe a re-installation of ROOT with the current libpng version will sort things out.

Thank you,

Best regards,

Cristian

Yes you should have a mismatch on your machine … are you using macport or something like that ?

Another thing I’ve noticed are the axis titles, and I can see you got the same as I did. In my script I set the titles as X (mm), Y (mm) and Z (mm), but as appear as X mm, Y mm, etc.

I’ve spent some time to solve this, then I gave up…

Only today I’ve noticed by accident that if I increase manually the canvas size, the axis titles are displayed correctly :confused:

Something related with canvas update maybe…

Best regards,

Cristian

No, I’m not using macports or fink. I just install the sotware manually from tar.gz files. I’ll try reinstalling ROOT.

Cristian

May be installing from sources can help.

[quote=“cbungau”]Another thing I’ve noticed are the axis titles, and I can see you got the same as I did. In my script I set the titles as X (mm), Y (mm) and Z (mm), but as appear as X mm, Y mm, etc.

I’ve spent some time to solve this, then I gave up…

Only today I’ve noticed by accident that if I increase manually the canvas size, the axis titles are displayed correctly :confused:

Something related with canvas update maybe…

Best regards,

Cristian[/quote]

It’s an unrelated problem - if you try to use “box” option axes still do not have ‘(’ and ‘)’ in their titles. And even if rotate the plot (thus updating canvas many times) you still to not see these parenthesis.
But it has something to do with SetCanvasPreferGL though …