Postscript ouput problem with text

Hi - I’m using 4.00/08 with SL3. The following:[code]

void testPlot(){

TH1F * myHist = new TH1F(“myHist”,“myHist”,100,0,1);
myHist->Fill(0.5);
myHist->SetXTitle(“photon fiducial #theta”);
myHist->Draw();

TPostScript * myps = new TPostScript(“ps/test.ps”,112);
myps->Range(26,20);
c1->Draw();
myps->Close();
delete myps;
}

[/code]

produces the postscript file:

www.slac.stanford.edu/~edward/test.ps

which has the screwed up theta, even though the original canvas does not. Is there something I can tweak to get the postscript to come out right? Thanks.

-Ed

Ed,

I can reproduce this problem. Olivier will investigate next week.
Thanks for reporting this problem.

Rene

The problem is due to the line:

myps->Range(26,20);

I will investigate why. So, unless you really need it (why ?) I would suggest you to comment it for the time being.

In fact the text painting in TPostScript depends on the gPad geometry (See Postscript::Text). So it is not surprising that if gPad and the PS output do not have the same aspect ratio you get some strange results. In your case the gPad and PS ratios are not very different so the errors are visible only in TLatex expression (in which the character positionning is very precise). But you can already notice that the axis labels are misplaced (see the Y axis). It would be even more visible if you define a very different ratio.

[quote=“couet”]The problem is due to the line:

myps->Range(26,20);

I will investigate why. So, unless you really need it (why ?) I would suggest you to comment it for the time being.[/quote]

I think the reason I was doing it was to get a landscape (vs portrait) -shaped postscript output.

To do that just use 111 for portrait and 112 for landscape.

Olivier - my memory was a bit hazy. I think that the reason I did it was actually to get the right paper size with some margins. (US letter).

Also - the class description specifically uses SetRange() in their examples, which might be why I originally used it:

root.cern.ch/root/html/TPostScri … ostScript:TPostScript

However, it looks like I can specify the information without using SetRange(), but I am a bit confused by the documentation. It mentions that your output type can be specified as [Format][Nx][Ny][Type], which I think corresponds to the 111, 112, etc numbers. So the default is 0 in these cases? If I want US Letter, it would be 100111, 100112?

Thanks.

-Ed

Also - I tried out the landscape mode, without setting range 26,20, using outputType = 100112. The results don’t look so hot:

slac.stanford.edu/~edward/new.ps

Using outputType 112, I get:

slac.stanford.edu/~edward/new2.ps

which is better, but still has these large margins on the top that I’d like to get rid of.

The original layout, using range 26,20 looks like:

slac.stanford.edu/~edward/orig.ps

I would actually like my margins to be very similar to that.

Also - a more general, non-ROOT question. What happens in EPS mode? Are there still margins?

Thanks.

The US formats are:

The US format Letter is selected by Format = 100.
The US format Legal is selected by Format = 200.
The US format Ledger is selected by Format = 300.

So, for instance 100112 is Letter Ladscape.

EPS is meant to be including in documents. The BoudingBox is defined in it. That is the one you should use if you want to include your output in a document.

So - is there any way to adjust the margins, as I mentioned in my previous post? Thanks.

In PS file the image is always aligned on the bottom left corner of the paper page.
If you want to position the graphics in a document , you should generate an EPS file. Then in the application (Latex, word, etc …) you can define the “margins” as you want.

Hi - but in this plot:

slac.stanford.edu/~edward/new.ps

The plot doesn’t even fill a decent portion of the page. I don’t think anyone would ever want that as the default behavior (as opposed to filling up the entire page).

That’s why it seems like the only solution, when outputting to postscript format, is to use TPostscript::SetRange(). But then that will potentially mess up the text in the titles.

Is it possible to change the code so that by default, a plot fills up a page (with some settable margins), and at the same time, the postscript text doesn’t get messed up? Should I put in a formal request for this via a different channel?

I prefer not to use EPS for these purposes because it doesn’t work as nicely when viewing single plots in ghostview.

Thanks.

-Ed

Ed,

Your request is inconsistent. You must have the same aspect ratio
on screen and on Postscript. If not, your picture will not ne correct.
So, you either set the same aspect ratio on the screen than Postscript
or you do not change the Postscript range.

Rene