3

I am starting playing with plots in latex.
In my preample I have:

\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}

My plots code: (first is copy from from tutorial, second is my attempt)

\begin{tikzpicture}
    \begin{axis}[xlabel=Cost,ylabel=Error]
    \addplot[color=red,mark=x] coordinates {
    (2,-2.8559703)
    (3,-3.5301677)
    (4,-4.3050655)
    (5,-5.1413136)
    (6,-6.0322865)
    (7,-6.9675052)
    (8,-7.9377747)
    };
    \end{axis}
\end{tikzpicture}
\begin{tikzpicture}
    \begin{axis}[ymin=0, ymax=12, xtick={25,50,75,100,125,150}, grid=major, xlabel=x label,
    ylabel=ylabel]
    \addplot[color=blue,mark=x] coordinates {
    (25,1)
    (50,1.87)
    (75,2.79)
    (100,3.78)
    (125,4.83)
    (150,5.83)
    };
    \addlegendentry{legend 1}
    \addplot[color=black,mark=o] coordinates {
    (25,1)
    (50,2.91)
    (75,4.27)
    (100,5.91)
    (125,7.82)
    (150,9.00)
    };
    \addlegendentry{legend 2}
    \end{axis}
\end{tikzpicture}

And result:
enter image description here

My question is: Why my plot do not have line between ticks? Am I missing something?

EDIT:

I am using Ubuntu 13.10 with Kile 2.1.3. I downloaded PGFPlots 1.9 from sourceforge and pointed TEXINPUTS system variable to its location.
I am posting full document. It produces pdf with content identical to image posted above. First plot has lines between marks, second does not. (preamble is pretty large, because it will be my master thesis)

\documentclass[a4paper,oneside,12pt]{report}

\usepackage[OT4]{polski}
\usepackage[utf8]{inputenc} 

\usepackage{graphicx}
\usepackage{setspace}
\usepackage{indentfirst}
\usepackage{titlesec}
\usepackage{nameref}
\usepackage{zref-user,zref-lastpage}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{enumerate}
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.9}

%listings configuration
\lstset{
language=SQL,
basicstyle=\small\sffamily,
numbers=left,
numberstyle=\tiny,
frame=tb,
columns=fullflexible,
showstringspaces=false
}

\onehalfspacing
\titleformat*{\section}{\normalsize\bfseries}

\setlength{\parindent}{1cm}

\begin{document}
\pagestyle{plain}

\begin{tikzpicture}
    \begin{axis}[xlabel=Cost,ylabel=Error]
    \addplot[color=red,mark=x] coordinates {
    (2,-2.8559703)
    (3,-3.5301677)
    (4,-4.3050655)
    (5,-5.1413136)
    (6,-6.0322865)
    (7,-6.9675052)
    (8,-7.9377747)
    };
    \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
  \begin{axis}[ymin=0, ymax=12, xtick={25,50,75,100,125,150}, grid=major, xlabel=x label,
ylabel=ylabel]
    \addplot[color=blue,mark=x] coordinates {
    (25,1)
    (50,1.87)
    (75,2.79)
    (100,3.78)
    (125,4.83)
    (150,5.83)
    };
    \addlegendentry{legend 1}
    \addplot[color=black,mark=o] coordinates {
    (25,1)
    (50,2.91)
    (75,4.27)
    (100,5.91)
    (125,7.82)
    (150,9.00)
    };
    \addlegendentry{legend 2}
  \end{axis}
\end{tikzpicture}

\end{document}
  • Do you mean "line between marks"? I tried your exact same code with pgfplots 1.8 and the marks are connected with lines in the second plot. My wild guess is that you are using an older version of pgfplots and it gets confused by the compat=1.9 command in the preamble (?) – alfC Nov 24 '13 at 10:06
  • I can't reproduce: I have lines between marks on both plots. Share a full MWE (with the preamble). – m0nhawk Nov 24 '13 at 10:06
  • @alfC It will fail on compilation for unavailable version of pgfplots in compat. – m0nhawk Nov 24 '13 at 10:08
  • @m0nhawk, yes, but what if errors are being ignored (for example by command line options), I guess anything can happen. Besides, (out of curiosity) what system/distro does have a working pgfplots 1.9 (I have TeXLive 2013 through Fedora and it still uses 1.8). – alfC Nov 24 '13 at 10:11
  • @alfC Both MikTeX and TeX Live (the TUG version) has version 1.9 of pgfplots, so either the one in Fedora isn't updated, or you haven't updated it (with tlmgr). (CTAN has 1.9, and both the systems I mentioned sync with CTAN.) – Torbjørn T. Nov 24 '13 at 12:39
  • I have edited question to give additional info about environment and posted document with full preamble. – Michał Herman Nov 24 '13 at 13:53
  • I cannot reproduce the problem with TeX Live 2013 in Kubuntu 13.10. Are you using the TeX Live from the Ubuntu repositories? I think that is a bit old, normally one would recommend installing directly from TUG (see e.g. http://tex.stackexchange.com/questions/1092/how-to-install-vanilla-texlive-on-debian-or-ubuntu) Anyway, if you add \listfiles just before \documentclass you will get a list of all packages used, and their version, near the end of the .log file. Can you remove all packages that doesn't influence the problem, and then also provide that list of packages? – Torbjørn T. Nov 24 '13 at 14:52
  • @TorbjørnT.: Agreed. Just tested with TeXLive2013 on Mac and seems to work fine: Both graphs have lines between the points. Voting to close this question. – Peter Grill Feb 21 '14 at 01:18

0 Answers0