Dear People, I am trying to include a barplot (see code below), in a latex document. However, the plot appears in totally the wrong position. I know this is not an R question as such, but the eps file is produced by R and I thought that perhaps other people had had similar problems and could give me pointers. Am I doing anything obviously wrong? Sincerely, Faheem Mitha. PS. the code I use to include the eps file is \begin{figure} \includegraphics[scale=0.7]{barplot.eps} \end{figure} which seems harmless enough. Faheem. ************************************************************************* roy <- c("white","blue","yellow") collen <- c(31,33,33) fmcol <- rep(roy,collen) postscript(file="barplot.eps",width=6.3,height=3,bg="white", horizontal=FALSE,paper="special",onefile=FALSE,fg="black") barplot(c(0.1,0.2,0.2,0.4,0,0,0,0,0,0,0,0,0,0.1), col=fmcol, names.arg=c("-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"), ylim=c(0,0.5),xlab="Values of x",ylab="Probability values",sub=NULL, style="old",main="Probability Histogram") dev.off() ************************************************************************** -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Torsten Hothorn
2001-Feb-08 07:05 UTC
[R] eps file not positioned properly in latex document
> Dear People, > > I am trying to include a barplot (see code below), in a latex document. > However, the plot appears in totally the wrong position.What means "totally the wrong position"?> I know this is > not an R question as such, but the eps file is produced by R and I thought > that perhaps other people had had similar problems and could give me > pointers. Am I doing anything obviously wrong? > > Sincerely, Faheem Mitha. > > PS. the code I use to include the eps file is > > \begin{figure} > \includegraphics[scale=0.7]{barplot.eps} > \end{figure}I tried: \usepackage{epsfig} blablabla... \begin{figure}[h] \begin{center} \epsfig{file=barplot.eps} \end{center} \end{figure} with your code, which looks fine. Note the waring messages:> roy <- c("white","blue","yellow") > collen <- c(31,33,33) > fmcol <- rep(roy,collen) > > postscript(file="barplot.eps",width=6.3,height=3,bg="white",+ horizontal=FALSE,paper="special",onefile=FALSE,fg="black")> > barplot(c(0.1,0.2,0.2,0.4,0,0,0,0,0,0,0,0,0,0.1), col=fmcol,+ names.arg=c("-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"), + ylim=c(0,0.5),xlab="Values of x",ylab="Probability values",sub=NULL, + style="old",main="Probability Histogram") Warning messages: 1: parameter "style" couldn't be set in high-level plot() function 2: parameter "style" couldn't be set in high-level plot() function> > dev.off()null device 1 Torsten> > which seems harmless enough. Faheem. > > ************************************************************************* > > roy <- c("white","blue","yellow") > collen <- c(31,33,33) > fmcol <- rep(roy,collen) > > postscript(file="barplot.eps",width=6.3,height=3,bg="white", > horizontal=FALSE,paper="special",onefile=FALSE,fg="black") > > barplot(c(0.1,0.2,0.2,0.4,0,0,0,0,0,0,0,0,0,0.1), col=fmcol, > names.arg=c("-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"), > ylim=c(0,0.5),xlab="Values of x",ylab="Probability values",sub=NULL, > style="old",main="Probability Histogram") > > dev.off() > > ************************************************************************** > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, 7 Feb 2001, Faheem Mitha wrote:> Dear People, > > I am trying to include a barplot (see code below), in a latex document. > However, the plot appears in totally the wrong position. I know this is > not an R question as such, but the eps file is produced by R and I thought > that perhaps other people had had similar problems and could give me > pointers. Am I doing anything obviously wrong?Yes, you should read the LaTeX manuals, for instance the "LaTeX Companion" LaTeX has its own preferences regarding placing of figures and tables. G?ran [...] -- G?ran Brostr?m tel: +46 90 786 5223 professor fax: +46 90 786 6614 Department of Statistics http://www.stat.umu.se/egna/gb/ Ume? University SE-90187 Ume?, Sweden e-mail: gb at stat.umu.se -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Winfried Theis
2001-Feb-08 07:29 UTC
[R] eps file not positioned properly in latex document
Hello! On 08-Feb-01 Faheem Mitha wrote:> Dear People, > > I am trying to include a barplot (see code below), in a latex document. > However, the plot appears in totally the wrong position. I know this is > not an R question as such, but the eps file is produced by R and I thought > that perhaps other people had had similar problems and could give me > pointers. Am I doing anything obviously wrong? > > Sincerely, Faheem Mitha.Well, this has to do with R since dev.print has landscape=TRUE as default, which causes the graphics to appear turned by 90 degrees. So there are two solutions: Setting landscape=FALSE in dev.print or adding angle=270 to your includegraphics line. Winfried> > PS. the code I use to include the eps file is > > \begin{figure} > \includegraphics[scale=0.7]{barplot.eps} > \end{figure} > > which seems harmless enough. Faheem. > > ************************************************************************* > > roy <- c("white","blue","yellow") > collen <- c(31,33,33) > fmcol <- rep(roy,collen) > > postscript(file="barplot.eps",width=6.3,height=3,bg="white", > horizontal=FALSE,paper="special",onefile=FALSE,fg="black") > > barplot(c(0.1,0.2,0.2,0.4,0,0,0,0,0,0,0,0,0,0.1), col=fmcol, > names.arg=c("-3","-2","-1","0","1","2","3","4","5","6","7","8","9","10"), > ylim=c(0,0.5),xlab="Values of x",ylab="Probability values",sub=NULL, > style="old",main="Probability Histogram") > > dev.off() > > ************************************************************************** > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. > - > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._. > _---------------------------------- E-Mail: Winfried Theis <theis at statistik.uni-dortmund.de> Date: 08-Feb-01 Time: 08:15:48 Dipl.-Math. Winfried Theis, Fachbereich Statistik, Graduiertenkolleg "Angewandte Statistik" Universität Dortmund, 44221 Dortmund Tel.: +49-231-755-5903 FAX: +49-231-755-4387 ---------------------------------- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear People, Thanks to everyone who replied. As several people pointed out, "in totally the wrong position" is not very helpful, but it was late and I was tired. Sorry about that. What I have is a page of text, and I want the barplot inserted about two-thirds of the way down the page, and it insisted on appearing at the top of the page. Both Dennis Murphy and Torsten Hothorn pointed me the solution, ie. the option h (here) to the figure environment, thus: \begin{figure}[h] \includegraphics[scale=0.7]{barplot.eps} \end{figure} I really don't understand why this isn't the default. (Apparently the default is tbp [top bottom page], but I don't understand how several of these options are applicable simultaneously. Perhaps this just means that if one of these is not possible it moves on to the next in order of preference?) As you can see, I am not really that experienced with these things, or I would have known this already. Sorry about cluttering up the list with irrelevant stuff. My Latex book sort of misled me by implying (in the section on \includegraphics) that if the figure did not appear in the right place, there might be something wrong with the bounding-box information. It turned out that the section on the figure environment was actually the relevant part. Sincerely, Faheem Mitha. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._