[R] R graphics and dpi

Zoltan Barta z.barta at bristol.ac.uk
Thu Aug 8 11:04:18 CEST 2002


Dear Roger,

On Wed, Aug 07, 2002 at 10:30:59PM -0700, Roger Peng wrote:
> Is there a way to tell at what dpi R generates graphics at?   I need to
> generate 600 dpi graphics for an article.

I would generate the graphics in eps then convert it with ghostscript. The
attached shell script can give some hints about this.

Zoltan

-- 

Zoltan BARTA
Z.Barta at bristol.ac.uk
http://delfin.klte.hu/~zbarta/
-------------- next part --------------
#! /bin/bash 

# convert .eps files to .tif files using ghostscript

b_nev=$1;
for f in "$b_nev"*.eps; do
    bf=`basename $f .eps`;
    echo -n Processing: $bf;
    infile=$bf.eps;
    outfile=$bf.tif;

# this gives the bounding box
    BB=`gs -dBATCH -dNOPAUSE -sDEVICE=bbox $infile 2>&1 | grep '^..B'`;
    echo -n ...;

# this set the paper size
    width=`echo "$BB"|awk '{print $4}'`;
    height=`echo "$BB"|awk '{print $5}'`;
    echo "width: $width, height: $height";

# this does the transformation
    gs -dBATCH -dNOPAUSE -dDEVICEWIDTHPOINTS=$width \
	-dDEVICEHEIGHTPOINTS=$height -sDEVICE=tiffg4 \
	-sOutputFile=$outfile -r600x600 $infile > /dev/null;
    echo done.
done


More information about the R-help mailing list