0

I've generated a number of plots in R, but two specific ones are giving me fits. I have two point processes from R (.ppp objects) that I've generated plots from, but no matter what file type I save them as, Texmaker will not read them in properly. I've tried using .eps files and the epstopdf package, but would only get an empty plot (only the axes and no points). I've tried saving the plot as a .png, .jpeg, and .pdf using the instructions (minus rsweave) here Getting R plots into LaTeX?, but every time I try to compile, I get the error "no output PDF file produced!" because "reading image file failed". I'm at my wit's end here.

I'm using Texmaker along with miktex 2.9, if that helps.

Edit: Don't use dev.new() after using png() when saving images in R (shown in the link). That is what was causing the load error.

Community
  • 1
  • 1
Claycrusher
  • 187
  • 3
  • 9
  • First of all it is not very clear for me if you try to generate automated report or just load `.png` file into your `latex` document. If it is the first you could try when using R studio open Sweave file and work with these simple example: `\documentclass{article} \begin{document} \begin{figure}[H] <<>>= foo <- c(1,2,3,4) barplot(foo) @ \end{figure} \end{document}` If it is the second remember that pictures have to be in the same folder as latex file. If it is not what you ask for please clarify. – An economist May 12 '16 at 12:01
  • Yes, this is not clear. If you could, post all the libraries you are working under as well as the error code (the whole thing as it prints out). – sconfluentus May 13 '16 at 01:54
  • \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} \usepackage{epstopdf} \usepackage[font=small]{caption} \usepackage{geometry} \usepackage[font=small]{subcaption} \usepackage{float} – Claycrusher May 13 '16 at 04:19
  • With the .eps files there is no error printed. It just prints the plot with the correct axes and labels but no points. Interestingly, it is only for data postings that the .eps files don't work. Curves and polygons plot just fine. I figured out what I was doing wrong with the .png file - I was using dev.new() after using png() and that would screw it up. – Claycrusher May 13 '16 at 04:22

0 Answers0