Hi, I’m trying to save my histogram from compiled C++ code using the command
hist1->SaveAs(“hist1.pdf”);
It creates a file “hist1.pdf” but it’s actually a plain-text macro for the histogram instead of the pdf.
does the same for .gif and .png or whatever I try to use
anysolutions?
//UPDATED—
I looked into it and it seems I should be using c1->SaveAs(“hist1.pdf”) where c1 is the name of the canvas.
So my question is how do I assign a histogram to a canvas?
well the macro runs just fine with the script, sorry if I hadn’t been more specific. The problem is that I’m running a compiled C++ script that opens an ntuple and then plots some 4 histograms… which I then need to open up in TBrowser and print each one individually after running the style macro… since I’m still learning root,I’m doing a lot of debugging and it is incredibly time consuming.
So what I did is I put the style macro into my compiled C++ script and have each histogram drawn onto the canvas and saves the canvas with each histogram I’d plot. All the styles are working except for SetCanvasColor
is there some reason this shouldnt work with compiled C++ coding? analyze.h (2.05 KB) analyze.cpp (7.65 KB)
So the problem shows when you read back the histograms and display them interactively in ROOT. Have you tried to put the style parameters I sent you in your rootlogon.C file ?
Yes, I was having trouble setting up my rootlogon.C file also. But I just figured that out 20 minutes ago. I’ll probably just use rootlogon.C and a macro to save each histo as an alternative.
I am also generating histogram and when trying to save as .png and insert it into MS word then after print it became dull. But my friend try it to save as .pdf then convert it into .jpg then it works and picture doen’t become blur. But in my case when I try to save as .pdf then histogram line became too thick and mess up created. Both files are attached. How can we fix??
Also #Delta symbol does not appear in .pdf format.