[R] png scaling problem

Marc Schwartz MSchwartz at mn.rr.com
Fri Sep 2 15:07:03 CEST 2005


Knut,

Gabor has provided a possible approach here.

Your comments on using postscript make me wonder how your code looked.
The following, for example, will create a 4 inch by 4 inch square plot
to an encapsulated postscript file (EPS). It will also specify/include
required resources for the Helvetica font, which is one of the
requirements on the page you reference. Since Helvetica is one of the
standard Adobe PS fonts, I don't believe that it is necessary to
actually "embed" the font here, which would be the case if you used a
non-standard font. If you open the EPS file in a text editor, you will
see many lines referring to 'Resources' and fonts.

 postscript("RPlot.eps", onefile = FALSE, horizontal = FALSE, 
             paper = "special", height = 4, width = 4, 
             family = "Helvetica", font = "Helvetica")

 barplot(1:10)

 dev.off()


They keys above are the 'onefile', 'horizontal' and 'paper' arguments,
which must be set as above to generate an EPS file with the specified
size and bounding box. The page referenced mentions creating the image
as close as possible to the actual size required, so be sure to set the
'height' and 'width' arguments per that specification.

Using postscript here will also better enable the 50% reduction that is
mentioned, given the vector based format here.

The key here also is to be sure that the plot looks good in the target
format, not on the screen, which includes text size, readability and
positioning, etc.

HTH,

Marc Schwartz


On Fri, 2005-09-02 at 02:03 -0400, Gabor Grothendieck wrote:
> If you have not already tried it try creating a fig file:
> 
> xfig("myfile.fig")
> plot(1:10)
> dev.off()
> 
> and then using the fig2dev utility (find it via google) to convert it to a tiff:
> 
> fig2dev -L tiff myfile.fig > myfile.tiff
> 
> 
> On 9/2/05, Knut Krueger <admin at biostatistic.de> wrote:
> > 
> > 
> > 
> > >Probably a better first question is, why are you using a bitmapped
> > >graphics format if you need the image to be re-scaled?
> > >
> > I need a 1000 dpi tif file in a size of appr. 10 to 10 cm for applied
> > animal behaviour science:
> > http://authors.elsevier.com/GuideForAuthors.html?PubID=503301&dc=GFA
> > 
> > images to one of the following formats (Note the resolution requirements
> > for line drawings, halftones, and
> > line/halftone combinations given below.):
> > EPS: Vector drawings. Embed the font or save the text as "graphics".
> > TIFF: Colour or greyscale photographs (halftones): always use a minimum
> > of 300 dpi.
> > TIFF: Bitmapped line drawings: use a minimum of 1000 dpi.
> > TIFF: Combinations bitmapped line/half-tone (colour or greyscale): a
> > minimum of 500 dpi is required.
> > DOC, XLS or PPT: If your electronic artwork is created in any of these
> > Microsoft Office applications please
> > supply "as is".
> > 
> > I tired the Postscript file but the file is double heigh as width i do
> > not know why.
> > The problem was already discussed in the tread: [R] High resolution plots
> > 
> > I have to send the images possibly yesterday and I am looking fo a
> > suitable solution since two months now.
> > I tired gsview with converting to all possible Tiff formats but the
> > images appear not in color and in a strange black and white way
> > Some readers are able to read it  (Windows Image view) other not and I
> > do not know which reader the journal will use :-(
> > And the ylab is too small ...
> > 
> > http://biostatistic.de/temp/1.tif
> > http://biostatistic.de/temp/2.tif
> > http://biostatistic.de/temp/3.tif
> > http://biostatistic.de/temp/4.tif
> > 
> > 
> > 
> > 
> > 
> > >In general,
> > >bitmapped graphics do not resize well, though if you have a specific
> > >need and know a target image size, you can adjust various parameters to
> > >look decent. Are you going to view these images in a web browser, where
> > >you are concerned with display size and resolution?
> > >
> > >>From your e-mail headers it appears you are on Windows. If you need a
> > >re-sizable graphic, use a vector based format such as wmf/emf,
> > >especially if you need the graphics embedded in a Windows application
> > >such as Word or Powerpoint. This is the default format under Windows
> > >when copying and pasting a graphic between applications. You can then,
> > >fairly freely, resize the image in the target application as you may
> > >require.
> > >
> > >If you are going to print the graphic directly or include it in a
> > >document for printing (as opposed to just viewing it), then use PDF or
> > >Postscript.
> > >
> > 
> > Ok there is a second description for the file format :-(
> > http://authors.elsevier.com/ArtworkInstructions.html?dc=AI2
> > there are pdf formats welcome but with defined conditions:
> > 
> > Maybe anybody could give me a hint to get the files in the recommendet
> > format.
> > I will ask them immediately which whether the pdf is allowed or not,
> > becaus they have two different instruction sites :-(
> > 
> > Regards Knut
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list