Thank you Professor Brian Ripley for very helpful comments.
Using type="tiff24nc" in bitmap mostly solved my problems. However, some
complicated figures still come out in greyscale with bitmap even when
using type="tiff24nc". The tiff function preserves the color but reduces
the character size as before. The good news is that dev2bitmap from X11
gives the correct figure. The newtest function below demonstrates this
behavior. I do have the latest R for my system
(R-core-2.8.1-8.fc10.x86_64).
Another question, is it possible to use lzw compression other than
type"tifflzw"? (the figures I produced with type="tiff24nc" are about 200
Mb. When opened and saved in photoshop with lzw compression they become
about 2 Mb).
Thank you
Regards
Einar Arnason
newtest(bitmap=T) # produces greyscale
newtest(tiff=T) # produces color with tiny characters
X11()
newtest()
dev2bitmap("dev2bitmaptest.tiff", width=17.15, height=17.15, units="cm",
You needed to update your R (see the posting guide). From the BUG
FIXES for 2.8.1 patched:
o grid-based plots no longer reset the base text size to the
default 96dpi in cairo-based bitmap devices.
Lattice plots are based on grid, and (probably) you are using the
cairo-based bitmap device.
On Sun, 5 Apr 2009, Einar ?rnason wrote:
Hi all,
I am trying to make tiff files of lattice plots at a resolution greater
than 300 dpi required by a journal (PLoS ONE). I have tried both the
tiff
and bitmap functions. tiff keeps panel colors but reduces axes and tick
labels so they are nearly invisible. bitmap maintains correct label size
but only produces greyscale. Regular plots work fine with tiff; the
problem is only with lattice plots.
How can I keep the right sizes using tiff or, alternatively, how can I
get
bitmap to produce colors?
Use the correct device type, e.g. tiff24nc (24 bit RGB). tifflzw is
black-and-white (see your ghostscript documentation).
I have made this test function using an xyplot example to demonstrate
the
problem.
`test` <- function(tiff=F, bitmap=F)
{
### requires states
### states <- data.frame(state.x77, state.name =
dimnames(state.x77)[[1]],
### state.region = state.region)
if(bitmap)
bitmap("bitmaptest.tiff", width=17.15, height=17.15, units="cm",
res=1200, pointsize=10, type="tifflzw",bg="white")
if(tiff)
tiff(file="tifftest.tiff",width=17.15,height=17.15,units="cm",
res=1200, pointsize=10, compression = "lzw")
### tiff(file="tifftest.tiff",width=17.15,height=17.15,units="cm",
###res=72, pointsize=10, compression = "lzw")
plot(xyplot(Murder ~ Population | state.region, data = states,
groups = state.name,
panel = function(x, y, subscripts, groups)
ltext(x = x, y = y, label = groups[subscripts], cex=0.5,
fontfamily = "HersheySans")))
if(bitmap)
dev.off()
if(tiff)
dev.off()
}
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595