[R] why is text being rasterized with text()

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 3 07:52:29 CEST 2008


We haven't been told your OS or the graphics device or how you viewed PDF 
output.  But all text on screen devices is rasterized -- they are raster 
devices.  (That includes your pdf viewer.)

You are writing the label 9 times in the same place.  I suspect what you 
are seeing is a viewer artifact of doing so -- the antialiasing isn't 
working for you.

On Thu, 3 Apr 2008, Andrew Yee wrote:

> Here's a question:  I noticed that when I tried to create this simple
> graph of rectangles and text, R appears to generate text that is
> rasterized (this is seen both on the monitor and when the output is
> directed to a pdf file).  Any thoughts?
>
> value.seq <- c("<4",as.character(seq(from=4,to=10)),">11")
> frame()
> par(usr=c(0,10,0,10) )
>
> for (r in 1:9) {
>
> rect(r,3,r+1,3.75, border = NA, col=heat.colors(9)[r])
>
> #this text does not appear to be rasterized
>   text(r+0.5,2.75, value.seq[r], cex=0.5)
>
> #this text appears to be rasterized
>
>   text(5.5,2.25,"expression (log2)", cex=0.5) }
>
> Thanks,
> Andrew
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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



More information about the R-help mailing list