[R] Margins in lattice and device resolution

Gustaf Rydevik gustaf.rydevik at gmail.com
Fri Apr 17 20:04:53 CEST 2009


Hi all,

I believe I've run into this before, but I seem to have totally
forgotten. No headway in the last couple of hours either. How do I
make sure that points and margins remain the same absolute size as I
change
the resolution of a device?
(I'm running 2.9.1 patched, on a Win XP-machine)

Many thanks in advance,

Gustaf

Ps: As an afterthought, might it be that this behaviour is related to
the receng grid-bug for text size in lattice when changing resolution?

----
Example:
.....

###This give a totally squished graph, where the actual plotting area is minimal
CairoPNG("example.png",width = 480, height = 480,
         dpi=600,
         pointsize = 12, bg = "white")
bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
       panel = "panel.superpose",
       panel.groups = "panel.linejoin",
       xlab = "treatment",
       key = list(lines = Rows(trellis.par.get("superpose.line"),
                  c(1:7, 1)),
                  text = list(lab = as.character(unique(OrchardSprays$rowpos))),
                  columns = 4, title = "Row position"))
dev.off()


### This gives a more norma looking graph
CairoPNG("example2.png",width = 480, height = 480,
         dpi=20,
         pointsize = 12, bg = "white")
bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
       panel = "panel.superpose",
       panel.groups = "panel.linejoin",
       xlab = "treatment",
       key = list(lines = Rows(trellis.par.get("superpose.line"),
                  c(1:7, 1)),
                  text = list(lab = as.character(unique(OrchardSprays$rowpos))),
                  columns = 4, title = "Row position"))
dev.off()

-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik




More information about the R-help mailing list