Thomas Schwander wrote: > Hi guys, > > > > I use R 2.6.2 and Windows XP. > > > > I’ve got the following question: I wrote a lot of text into the margin of a > plot. When I use the “jpeg”-function, only a little part of the margin text > is displayed in the final jpeg? Any ideas to change it? > > > > Source-Code: > > > > datenbankdaten<-data.frame(LETTERS[1:20], > > c(8,4.8,3.8,2.7,2.6,2.1,2,1.9,1.6,1,0.99,0.98,0.98,0.97,0.96,.96,0.8,0.8,0.7 > ,0.6), > > c(8,4.8,3.8,0,2.6,2.1,2,1.9,1.6,1.1,0.99,0.98,0.97,0.97,0.96,.95,0.8,0.8,0,0 > .6)) > > > > Zugehoerigkeit<-LETTERS[1:20] > > > > Bezeichnung<-letters[1:20] > > > > colnames(datenbankdaten)<-c("Bezeichnung","A","B") > > > > # par = Setzt die Grafikparameter, die durch plot automatisch verwendet > werden > > # mar = Anzahl der Textzeilen von den inneren Achsen des Schaubild zum Rand > > # Zeilenvektor: c(bottom, left, top, right) > > par(mar=c(3,4,4,25),family="serif") > > > > Fontparameter<-1 > > > > today<-Sys.Date() > > Vormonat<-Sys.Date()-20 > > > > Stand_aktuell<-format(today, "%B %Y") > > Stand_Vormonat<-format(Vormonat, "%B %Y") > > jpeg(paste("C:\\TOP-20.jpeg",sep=""),quality=100,width=1024, height=768) > > > plot(datenbankdaten[,2],ylim=c(0,max(datenbankdaten[,2],datenbankdaten[,3])) > , > > xlab="", ylab="", > > > font.axis=Fontparameter,font.lab=Fontparameter,font.main=Fontparameter,font. > sub=Fontparameter, > > bty="n",axes=F) > > axis(1,at=1:20,label=rep("",20)) > > axis(1,at=1:9,label=sprintf("0%.0f",1:9)) > > axis(1,at=10:20,label=10:20) > > Maximum<-max(datenbankdaten[,2],datenbankdaten[,3]) > > axis(2,at=0:Maximum,label=sprintf("%.2f",0:Maximum)) > > for(i in 1:(length(datenbankdaten[,2])+2)){ > > abline(h=i-1) > > } > > for(i in 1:20){ > > if(datenbankdaten[i,2]>=datenbankdaten[i,3]) farbe="red" else > farbe="green" > > > arrows(i,datenbankdaten[i,2],i,datenbankdaten[i,3],col=farbe,length=0,lwd=1. > 5) > > points(i,datenbankdaten[i,2],pch=22,col="light blue",bg="light > blue",cex=1.7) > > > points(i,datenbankdaten[i,3],pch=21,col="grey",bg="grey",cex=1.5) > > } > > > > for(i in 1:20){ > > if(datenbankdaten[i,2]>datenbankdaten[i,3]) > > #dreieck nach oben > > > points(i,datenbankdaten[i,2]-0.1,pch=24,col="red",bg="red") > > if(datenbankdaten[i,2]<datenbankdaten[i,3]) > > #dreieck nach unten > > > points(i,datenbankdaten[i,2]+0.1,pch=25,col="green",bg="green") > > } > > # Legend muss noch in die Ränder geschrieben werden, würde besser aussehen > > > > Verkleinern<-0.8 > > > > for(i in 1:20){ > > > > if(i<=9) text(par("usr")[2] + 0.5, Maximum-(i-1)*0.4, srt=0, adj = 0, labels > = sprintf("0%.0f",i),xpd = TRUE,cex=Verkleinern) > > else text(par("usr")[2] + 0.5, Maximum-(i-1)*0.4, srt=0, adj = 0, labels = > i,xpd = TRUE,cex=Verkleinern) > > > > text(par("usr")[2] + 1, Maximum-(i-1)*0.4, srt=0, adj = 0, > labels = Zugehoerigkeit[i], > > xpd = TRUE,cex=Verkleinern) > > text(par("usr")[2] + 3.6, Maximum-(i-1)*0.4, srt=0, adj = 0, > labels = Bezeichnung[i], > > xpd = TRUE,cex=Verkleinern) > > } > > > > lines(c(par("usr")[2] + 0.4,par("usr")[2] + > 0.4),c(Maximum+0.1,0.25),xpd=TRUE) > > lines(c(par("usr")[2] + 11.5,par("usr")[2] + > 11.5),c(Maximum+0.1,0.25),xpd=TRUE) > > lines(c(par("usr")[2] + 0.9,par("usr")[2] + > 0.9),c(Maximum+0.1,0.25),xpd=TRUE) > > lines(c(par("usr")[2] + 3.45,par("usr")[2] + > 3.45),c(Maximum+0.1,0.25),xpd=TRUE) > > > > Abstand<-Maximum-0.15 > > > > # aktueller Standpunkt > > for(i in 1:20){ > > lines(c(par("usr")[2] + 0.4,par("usr")[2] + > 11.5),c(Maximum+0.1-Abstand*(i-1)/20,Maximum+0.1-Abstand*(i-1)/20),xpd=TRUE) > > } > > lines(c(par("usr")[2] + 0.4,par("usr")[2] + 11.5),c(0.25,0.25),xpd=TRUE) > > > > #Ende Test > > > > legend("topright",legend=c(Stand_aktuell,Stand_Vormonat),pch=c(22,21), > > bty="o",pt.bg=c("light blue","grey"),cex=0.8,bg="white") > > > > dev.off() > Hi Thomas, You seem to have a very wide table on the right of the plot, try this:
x11(width=10,height=7) par(mar=c(5,4,4,20)) plot(... Jim ______________________________________________ R-help@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.