Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Graph png format - differences in scaling between vers. 10 and 11


From   cnguyen@stata.com
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Graph png format - differences in scaling between vers. 10 and 11
Date   Wed, 17 Mar 2010 11:38:10 -0500

Johannes Geyer <JGeyer@diw.de> wrote:

> I just stumbled across an unexpected behaviour. I updated some graphs for 
> a Beamer-Latex presentation. I used the "png" format. But I used Stata 11 
> instead of Stata 10. The result was a file smaller than the previous 
> version (by a factor of four) with a smaller resolution. I guess, png is 
> not a vector format and not indifferent to scaling. So, there is a smaller 
> picture with less pixels which looks less nice when its size is increased. 
> Even if I use Stata version-control, there is no difference. These new 
> graphs look bad in the presentation, so I recreated them using Stata 10. 

As others have mentioned, you should always export Stata's graphs to a vector
format for publication quality output.  The PNG format is not a vector format
but a bitmap format and does not scale well.

As to why Johannes is seeing different behavior in Stata 11 and Stata 10 when
exporting his graphs to the PNG format (or any other bitmap format such as
TIFF), I believe it's simply because his graph window in Stata 11 is smaller
than his graph window in Stata 10.

When Stata exports a graph to a bitmap format such as PNG or TIFF, Stata
exports the bitmap image using the dimensions of the image displayed in the
Graph window.  The exported image is pretty much a snapshot of what's in the
Graph window.  If you make the Graph window really large, you'll get a
bitmap with large dimensions.  If you make the Graph window really small,
you'll get a bitmap with small dimensions.  You can specify the pixel
dimensions of the exported bitmap by using the width() and/or height()
options.  If you specify just the width() or height() option, Stata will
determine the appropriate pixel height or width based on the graph's aspect
ratio (which is determined by xsize/ysize).

When exporting graphs to a bitmap format, I recommend always using the width()
option to get consistent output.

-Chinh Nguyen
 cnguyen@stata.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index