Exact sizes (was: Re: [ROOT] Divide pad problem)

From: Maxim Nikulin (nikulin@gorodok.net)
Date: Fri Feb 27 2004 - 16:09:32 MET


Dear Olivier,

I thank you for your comments but sometimes I can be obstinate...

You wrote:
>  When you define a canvas size (50x50 and 200x200 in your case), it 
> includes the window decoration puts by the window manager around the 
> graphics part. For large windows it can be consider as negligible but for 
> small windows (like 50x50) it becomes very clear that the graphics area is 
> not square. Using the UNIX command xwininfo you can check that the 
> whole window is 50x50. So if  you want a graphics area being 50x50 pixels 
> you should take into account the window decoration around (which depends 
> on your window manager setup).

First of all, xwininfo showed 42x42. I found I should say 
gStyle->SetScreenFactor(1.) to get 50x50. I captured the canvas by GIMP 
and saw that the decorated window was lager than 50x50. The canvas had 
size of exactly 50x50. The height/width ratio was distorted by the 
Canvas menu bar. I added TCanvas::SetWindowSize() to set correct size 
and gSystem->ProcessEvents() to flush changes. Now bounding boxes in the 
PostScript files seem to be right.

I have next question concerning object sizes in PostScript files. I've 
added a marker to my plots (See the file attached). The markers are 
large on the screen and small in the .eps files. How can I get desirable 
marker size (for example 6 pt or 1/2 font size)?

-- 
Best regards,
Maxim Nikulin

> On Thu, 26 Feb 2004, Maxim Nikulin wrote:
> 
>>Dear Olivier,
>>
>>You wrote:
>>
>>>>Pixels are good units for plots on a screen. What should I do if I wish
>>>>just 12 pt font size in the PostScript file?
>>>
>>> The text you'll see on screen (in pixel size) will be exactly the same in 
>>>the PostScript file. But I cannot guarantee that if you fix the size to 12 
>>>pixels, that will correspond exactly, for instance, to a 12pt size in a 
>>>Word document ...
>>
>>The problem is to get exact sizes on a PostScript plot. For example, 
>>what should I do if I want a 5x5 cm picture containing a 12 pt label. 
>>The script attached sets 5x5 cm paper size, 12 px font and draws a TText 
>>in 50x50 px and 200x200 px canvases, prints their to .eps files. I get 
>>plots having different height/width ratio (of course != 1).




{
   gStyle->SetPaperSize(5, 5);
   gStyle->SetTextFont(133);
   gStyle->SetTextSize(12);
   gStyle->SetScreenFactor(1.);
   gStyle->SetMarkerSize(1);
   c50x50 = new TCanvas("c50x50", "c50x50", 50, 50);
   c50x50->SetWindowSize(50 + (50 - c50x50->GetWw()),
                         50 + (50 - c50x50->GetWh())); 
   text1 = new TText(.10, .10, "Text");
   text1->Draw();
   marker = new TMarker(0.25, 0.5, 2);
   marker->Draw();
   gSystem->ProcessEvents();
   c50x50->Print("c50x50.eps");
   c200x200 = new TCanvas("c200x200", "c200x200", 200, 200);
   c200x200->SetWindowSize(200 + (200 - c200x200->GetWw()),
                         200 + (200 - c200x200->GetWh())); 
   text1->Draw();
   marker->Draw();
   gSystem->ProcessEvents();
   c200x200->Print("c200x200.eps");
}

   



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET