Skip to content
Prev 105594 / 398503 Next

A question on grid - grid.points not spaced properly

Hi
Saptarshi Guha wrote:
R graphics is a vector system rather than a raster system, which means
that all locations and dimensions are effectively on an infinite
resolution device.  There are no "pixels" to refer to.  So you are
already placing the dots exactly.

When graphics are rendered by a specific device, there will be rounding
if the device is raster (e.g., screen).  So not all devices can render
your dots exactly.

If you know that your plotting character will only be rendered on a
raster device, "native" coordinates in the top-level grid viewport refer
(approximately) to pixels, e.g.,
just=c("left", "bottom"))
just=c("left", "bottom"))
just=c("left", "bottom"))

but you can still get rounding problems and these coordinates are not
available in any other grid viewport.

In other words, you cannot predict exactly which pixels will get turned
on when you draw something on screen with R graphics.

If it's any consolation, this is true of the predefined plotting symbols
too!  (do all the plusses look the same on screen?)

plot(1:10, 1:10, pch=3)

Paul

p.s.  An exercise for the reader:  why do all of these plusses look the
same on screen?

plot(1:10, 1:10, pch="+")