1

I am trying to do a simple x-y plot. However, I have no idea what I am doing, which result in the duplicates to be no helpful for me. I was based on this tutorial. Can you help please?

\documentclass{article} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}

\begin{document}

\begin{tikzpicture}
1.a. \draw[<->] (12225,0)  -- (0,0) --
(0,6);
1. \draw[<->] (12225,0) node[below]{$speedup$} -- (0,0) --
(0,6) node[left]{$N$};
2. \draw[very thick] (755, 1.4) --(1978, 1.6) -- (6273, 1.8) -- (12222, 2.1);
\end{tikzpicture}

\end{document}
gsamaras
  • 1,443

1 Answers1

2
  1. please update your system as pgfplots 1.9 is quite old.
  2. get rid of those numbers in front of \draw (I guess they are a copy paste error)
  3. reduce the numbers in your coordinates. The TikZ coordinates are measured in cm by default. You can change this but why do you want to have something at point 12222? The maximum right here seems to be 575 but still, 575 cm won't fit in your article, I fear.
  4. For your example you just need to load tikz.
  5. $speedup$ is wrong. Leave away the dollar signs or do \textit{speedup}, if you want italics.

I would recommend to go with pgfplots:

% arara: pdflatex

\documentclass{article} 
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}

\begin{document}    
\begin{tikzpicture}
    \begin{axis}[%
        ,xlabel=$N$
        ,ylabel=speedup
        ,axis x line=bottom
        ,axis y line=left
        ]
        \addplot[very thick] coordinates {(755,1.4) (1978, 1.6) (6273, 1.8) (12222, 2.1)};
    \end{axis}
\end{tikzpicture}   
\end{document}

enter image description here

LaRiFaRi
  • 43,807
  • 1
    Thanks LaRiFaRi (nice name). I have texmaker and the last time I tried to update and I failed. If you have any guide, please let me know! (btw this work with compat=1.9 too) – gsamaras Aug 07 '15 at 11:00
  • Great, now I have no editor: http://askubuntu.com/questions/657653/dpkg-error-processing-archive-with-texmaker – gsamaras Aug 07 '15 at 11:21
  • @gsamaras Yes, for such easy graphs it is of course enough. I just thought that maybe your whole system could be a bit outdated. See here: http://tex.stackexchange.com/q/55437. Sorry for your editor problem. – LaRiFaRi Aug 07 '15 at 11:47
  • It's not your fault! I have Ubuntu 14.04! Anyway, thanks for the good answer. :) I had checked the link before, but thanks. One last question, do you know how I can make the x axis appear in powers of 3, instead of 4? – gsamaras Aug 07 '15 at 12:44
  • @gsamaras scaled x ticks=base 10:3 I believe. Search the really good manual for 'scientific notation' – LaRiFaRi Aug 07 '15 at 12:53
  • Editor updated! No, that will place a 10^-3. I am searching for the man. Found: scaled x ticks=base 10:-3. This – gsamaras Aug 07 '15 at 13:08