qual o comando que é similar ao windows.options() no Linux, pois este não
existe para o Linux.
O objetivo final é criar uma função que me gera a figura da legenda,
porém esta função tem rodar
tanto no Windows quanto no Linux. Pois gostaria que a figura da legenda
se ajuste para os mais
variados números de faixas.
Abaixo segue um exemplo. (Acredito que função não a mais eficiente,
qualquer sugestão é bem-vinda)
Obrigado.
gera_figura_legenda=function(brks, cols,r) {
brks =
round(brks,r)
dest.fig =
tempfile(pattern="legenda",fileext=".png",tmpdir=getwd())
windows.options(width=2.5, height=1.7,
pointsize=12, reset = TRUE)
CairoPNG(filename = dest.fig, width = 290, height
= 290, bg="#FFFFFF00", pointsize = 10)
par(bg="transparent", mar=c(0, 0, 0, 0))
brks =
round(brks,r)
plot(1,1,col="white",axes=F,col.axis="white",xlab="",ylab="")
aux1 =
2:(length(brks)-1)
aux2 =
expand.grid(aux1,aux1)
d
= aux2[,1]-aux2[,2]
aux3 =
aux2[d==-1,]
legend(
"center",
title =
"Legenda",
c(paste("<",brks[2]),
paste(brks[aux3[,1]],brks[aux3[,2]],sep="-"),
paste(">",brks[(length(brks)-1)])),
fill=c(cols),
cex=1.3,
bg="#FFFFFF")
dev.off()
return
(dest.fig)
}
--
Luís Gustavo Silva e Silva