Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to plot an image file in a pdfplots axis. This is a minimal example (the files fig2a.eps and fig2a.png both contain the image that should be plotted):

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot graphics[xmin=-0.15, xmax=0.15, ymin=0.0, ymax=0.2] {fig2a};
\end{axis}
\end{tikzpicture}
\end{document}

When compiling with pdflatex, I get exactly what I want. With latex (producing a dvi file), the tick labels are all on top of each other inside the image, so something goes wrong with the positioning.

I suppose version information is useful in this case -- from the output to the screen I have this when running both latex and pdflatex:

This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)

What am I doing wrong?

share|improve this question
    
Could you provide the image, or else a link to it? –  cmhughes Jan 28 '13 at 17:20
    
The images can be found here: png version and eps version. The png was generated by python/matplotlib, and converted to eps with imagemagick (convert fig2a.png fig2a.eps). –  josteinb Jan 28 '13 at 19:37
    
The dvi output is just an intermediate format; it cannot be viewed. I suppose that you looked at the resulting .pdf or .ps? If so, how did you convert the .dvi to .pdf (or .ps)? TikZ needs to know this so-called "driver" in order to produce a proper output dvi. Without the correct driver, the output will be screwed up. –  Christian Feuersänger Jan 29 '13 at 19:13
    
@ChristianFeuersänger: Sorry, I didn't know this about the dvi output, so I was looking at that directly. After setting the \pgfsysdriver macro and converting the dvi to ps with dvips things look as they should. Feel free to post your comment as an answer. Thanks! –  josteinb Feb 4 '13 at 10:38
add comment

1 Answer 1

up vote 3 down vote accepted

The dvi output is just an intermediate format; it cannot be viewed.

I suppose that you looked at the resulting .pdf or .ps? If so, how did you convert the .dvi to .pdf (or .ps)? TikZ needs to know this so-called "driver" in order to produce a proper output dvi. Without the correct driver, the output will be screwed up.

Here is a brief list of the most common drivers:

% needed for latex; dvipdfm
%\def\pgfsysdriver{pgfsys-dvipdfm.def}

% needed for pdflatex and/or lualatex (it is detected by default)
%\def\pgfsysdriver{pgfsys-pdftex.def}

% needed by latex; dvips (it is detected by default)
%\def\pgfsysdriver{pgfsys-dvips.def}

% needed by latex; dvipdfmx
%\def\pgfsysdriver{pgfsys-dvipdfmx.def}

% needed by xelatex 
%\def\pgfsysdriver{pgfsys-xetex.def}
\usepackage{pgfplots} % or \usepackage{tikz}; same thing.

If you use latex; dvips or pdflatex or lualatex, the driver is detected automatically. In all other cases, you'd need to write the correct driver statement.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.