Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: graph export to pdf


From   [email protected]
To   [email protected]
Subject   Re: st: graph export to pdf
Date   Fri, 20 Jan 2006 13:31:25 -0600

Bill Rising <[email protected]> asked:

> Is there any hack to get -graph export foo.pdf- to produce a pdf  
> which is the same size as the graph itself? I could be missing  

Exporting to PDF (Mac only) is nothing more than Stata printing the graph to a
PDF file.  Here's how you do what you want to do:

Select File > Page Setup... from Stata.  

Change the Settings drop down list to Custom Paper Size.

Click the New button and name the setting.  I named mine
"6x4 stata graph pdf".

Enter the desired height and width in inches and 0 for all the margins.  I
entered 4 for the Height, 6 for the width.

Click the Save button.

Change the Settings drop down list back to Page Attributes, select your new
custom page size from the the Paper Size drop down list, then click OK.

Open the Graph Preferences dialog and click the Printer tab.

Set the left and top margins to 0 but leave all the other settings the same,
then click OK.

Draw your graph but make sure to draw it at the same size as your custom paper
size.  I drew my graph making with the xsize at 6 and the ysize at 4:

. sysuse auto
. sc mpg weight, xsize(6) ysize(4)
. graph export mygraph.pdf

Perhaps one day we'll add options to PDF exporting when we move away from
using the PICT format for the Clipboard.  It's not possible now because
Stata's graphics engine does not natively draw in PDF format (yet).

-Chinh Nguyen
 [email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index