Dear R users,
My question is about finding the proper font size for graphics.
For this i had written a code that creats 4 diferent graphics and saves
them as a png file.
>From these PNG.graphics , i select one of the proper size and past it to a
word document.
I have experimented with lots of settings yet:nd lost my track a bit.
there are cex; cexaxis cexlabes and so on, i lost track of wich cex does
what exactly.
Fruthermore, these graphs work well in an R window, yet when i open the
png file it did not print the labels of bottom x axis.
One other problem i have is that often '10' on the botom x axis is not
printed.
I tried to patch it up this way (below), yet its unsatisfactory, sometimes
it works sometimes it don't.
axis(1,at=c(28:30),c('','10','') , padj=-1.5 ,
cex.axis=ifelse((rol==1),setting[rol,8]-0.15,setting[rol,8]-0.1))
And finaly, when creating the graphs, i prefer the size of graf_1_small
it pastes easaly to a word documentn ( 2 one one line),
yet the labels are not always clear to read, so i copy the one without
suffix to word then i size it to 75%, wich means it loses some quality.
The question here is, can anyone help me with the right cex sizes?
I gues that that is the question in general, since it are the cex that are
eighter printed or not, on all these graph's.
Thaks in advance,
T
here is my example:
# saving Directory
WinDir <- "C:/Documents and Settings/towil/Projecten"
# data
trials <- rep(1:10,3)
test <-
c(rep("Low",10),rep("Normal",10),rep("Randomised",10))
means <- rbeta(1:30,11,3)+rbeta(1:30,8,3)
ci <- rbeta(1:30,1,2)
meanstable <- data.frame(
"Trial"=trials,"Test"=test,"Means"=
means,"Upper"=means+ci ,"Lower"=means-ci)
graf_1 <- "Means 1"
graf_2 <- "Means 2"
# settings for different graph's
setting <-
data.frame('adname'=c(paste(graf_1,'_small'),graf_1,paste(graf_1,'_big')),'width'=c(300,400,500),'height'
= c(300,400,500), 'pointsetting' =
c(10,12,14),'Directory'=rep(WinDir,3),
'cex.lab'= c(0.85,0.9,1),'cexsize'= c(0.8,1,1.2),
'cex.axis'=
c(0.6,0.9,1))
# loop for different graph's
for(rol in 1:3){
save_at <-WinDir
setwd( save_at)
x11()
png(filename =
paste(graf_1,setting[rol,1],".png",sep=""),width =
setting[rol,2], height = setting[rol,3],pointsize = setting[rol,4], bg =
"white", res = NA)
plot(1:nrow(meanstable),meanstable$Mean, xlim=c(0,nrow(meanstable)),ylim=
ylimits, xaxt='n', pch = 19,
frame.plot=F,xlab='',ylab=lg10_label,cex.lab=setting[rol,6],cex.axis=setting[rol,8])
arrows(1:nrow(meanstable) , meanstable$Upper , 1:nrow(meanstable) ,
meanstable$Lower, lty=3, code = 3, angle = 45, length = .1)
axis(3,at=1:2,unique(meanstable$Test)[c(1,2)],las=1 ,hadj=0.5,
padj=c(1,0),cex.axis=setting[rol,8]) # upper X axis
axis(3,at=2:3,unique(meanstable$Test)[c(2,2)],las=1 ,hadj=0.5,
padj=c(0,-1),cex.axis=setting[rol,8])
axis(3,at=3,unique(meanstable$Test)[3],las=1,
hadj=0,padj=-1,cex.axis=setting[rol,8])
axis(1,at=c(1:3),c('','1','') , padj=-1 ,
cex.axis=setting[rol,8]) #
lopwer x axis this does not show on the png files, yet it works in an r
graphic
axis(1,at=c(4:6),c('','2','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(7:9),c('','3','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(10:12),c('','4','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(13:15),c('','5','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(16:18),c('','6','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(19:21),c('','7','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(22:24),c('','8','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(25:27),c('','9','') , padj=-1 ,
cex.axis=setting[rol,8])
axis(1,at=c(28:30),c('','10','') , padj=-1 ,
cex.axis=setting[rol,8])
dev.off()
}
#
graphics.off()
End of example.
Disclaimer: click here
[[alternative HTML version deleted]]